Coverage Report - org.apache.maven.doxia.wrapper.AbstractWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractWrapper
0%
0/27
0%
0/18
1,75
 
 1  
 package org.apache.maven.doxia.wrapper;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.Serializable;
 23  
 
 24  
 import org.codehaus.plexus.util.StringUtils;
 25  
 
 26  
 /**
 27  
  * Abstract wrapper for Doxia converter.
 28  
  *
 29  
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
 30  
  * @version $Id: AbstractWrapper.java 786981 2009-06-21 10:01:58Z ltheussl $
 31  
  */
 32  
 abstract class AbstractWrapper
 33  
     implements Serializable
 34  
 {
 35  
     public static final String AUTO_FORMAT = "auto";
 36  
 
 37  
     private String format;
 38  
 
 39  
     private String[] supportedFormat;
 40  
 
 41  
     /**
 42  
      * @param format could be null.
 43  
      * @param supportedFormat not null.
 44  
      * @throws IllegalArgumentException if supportedFormat is null.
 45  
      */
 46  
     AbstractWrapper( String format, String[] supportedFormat )
 47  0
     {
 48  0
         this.format = ( StringUtils.isNotEmpty( format ) ? format : AUTO_FORMAT );
 49  0
         if ( supportedFormat == null )
 50  
         {
 51  0
             throw new IllegalArgumentException( "supportedFormat is required" );
 52  
         }
 53  0
         this.supportedFormat = supportedFormat;
 54  0
     }
 55  
 
 56  
     /**
 57  
      * @return the wanted format.
 58  
      */
 59  
     public String getFormat()
 60  
     {
 61  0
         return this.format;
 62  
     }
 63  
 
 64  
     /**
 65  
      * @param format The wanted format.
 66  
      */
 67  
     void setFormat( String format )
 68  
     {
 69  0
         this.format = format;
 70  0
     }
 71  
 
 72  
     /**
 73  
      * @return the supportedFormat
 74  
      */
 75  
     public String[] getSupportedFormat()
 76  
     {
 77  0
         return supportedFormat;
 78  
     }
 79  
 
 80  
     /**
 81  
      * @param supportedFormat the supportedFormat to set
 82  
      */
 83  
     void setSupportedFormat( String[] supportedFormat )
 84  
     {
 85  0
         this.supportedFormat = supportedFormat;
 86  0
     }
 87  
 
 88  
     /** {@inheritDoc} */
 89  
     public boolean equals( Object other )
 90  
     {
 91  0
         if ( this == other )
 92  
         {
 93  0
             return true;
 94  
         }
 95  
 
 96  0
         if ( !( other instanceof AbstractWrapper ) )
 97  
         {
 98  0
             return false;
 99  
         }
 100  
 
 101  0
         AbstractWrapper that = (AbstractWrapper) other;
 102  0
         boolean result = true;
 103  0
         result =
 104  
             result && ( getFormat() == null ? that.getFormat() == null : getFormat().equals( that.getFormat() ) );
 105  0
         return result;
 106  
     }
 107  
 
 108  
     /** {@inheritDoc} */
 109  
     public int hashCode()
 110  
     {
 111  0
         final int result = 17;
 112  0
         final int hash = 37;
 113  
 
 114  0
         return hash * result + ( format != null ? format.hashCode() : 0 );
 115  
     }
 116  
 
 117  
     /** {@inheritDoc} */
 118  
     public java.lang.String toString()
 119  
     {
 120  0
         StringBuffer buf = new StringBuffer();
 121  0
         buf.append( "format = '" );
 122  0
         buf.append( getFormat() + "'" );
 123  0
         return buf.toString();
 124  
     }
 125  
 }