1 package org.apache.maven.doxia.wrapper;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.Serializable;
23
24 import org.codehaus.plexus.util.StringUtils;
25
26
27
28
29
30
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
43
44
45
46 AbstractWrapper( String format, String[] supportedFormat )
47 {
48 this.format = ( StringUtils.isNotEmpty( format ) ? format : AUTO_FORMAT );
49 if ( supportedFormat == null )
50 {
51 throw new IllegalArgumentException( "supportedFormat is required" );
52 }
53 this.supportedFormat = supportedFormat;
54 }
55
56
57
58
59 public String getFormat()
60 {
61 return this.format;
62 }
63
64
65
66
67 void setFormat( String format )
68 {
69 this.format = format;
70 }
71
72
73
74
75 public String[] getSupportedFormat()
76 {
77 return supportedFormat;
78 }
79
80
81
82
83 void setSupportedFormat( String[] supportedFormat )
84 {
85 this.supportedFormat = supportedFormat;
86 }
87
88
89 public boolean equals( Object other )
90 {
91 if ( this == other )
92 {
93 return true;
94 }
95
96 if ( !( other instanceof AbstractWrapper ) )
97 {
98 return false;
99 }
100
101 AbstractWrapper that = (AbstractWrapper) other;
102 boolean result = true;
103 result =
104 result && ( getFormat() == null ? that.getFormat() == null : getFormat().equals( that.getFormat() ) );
105 return result;
106 }
107
108
109 public int hashCode()
110 {
111 final int result = 17;
112 final int hash = 37;
113
114 return hash * result + ( format != null ? format.hashCode() : 0 );
115 }
116
117
118 public java.lang.String toString()
119 {
120 StringBuffer buf = new StringBuffer();
121 buf.append( "format = '" );
122 buf.append( getFormat() + "'" );
123 return buf.toString();
124 }
125 }