View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.xbean.spring.generator;
18  
19  /**
20   * @author Dain Sundstrom
21   * @version $Id$
22   * @since 1.0
23   */
24  public class AttributeMapping implements Comparable {
25      private final String attributeName;
26      private final String propertyName;
27      private final String description;
28      private final Type type;
29      private final String value;
30      private final boolean fixed;
31      private final boolean required;
32  	private final String propertyEditor;
33  
34      public AttributeMapping(String attributeName, String propertyName, String description, Type type, String value, boolean fixed, boolean required, String propertyEditor) {
35          this.propertyEditor = propertyEditor;
36  		if (attributeName == null) throw new NullPointerException("attributeName");
37          if (propertyName == null) throw new NullPointerException("propertyName");
38          if (type == null) throw new NullPointerException("type");
39          this.attributeName = attributeName;
40          this.propertyName = propertyName;
41          if (description == null) description = "";
42          this.description = description;
43          this.type = type;
44          this.value = value;
45          this.fixed = fixed;
46          this.required = required;
47      }
48  
49      public String getAttributeName() {
50          return attributeName;
51      }
52  
53      public String getPropertyName() {
54          return propertyName;
55      }
56  
57      public String getDescription() {
58          return description;
59      }
60  
61      public Type getType() {
62          return type;
63      }
64  
65      public String getValue() {
66          return value;
67      }
68  
69      public boolean isFixed() {
70          return fixed;
71      }
72  
73      public boolean isRequired() {
74          return required;
75      }
76  
77      public int hashCode() {
78          return attributeName.hashCode();
79      }
80  
81      public boolean equals(Object obj) {
82          if (obj instanceof AttributeMapping) {
83              return attributeName.equals(((AttributeMapping) obj).attributeName);
84          }
85          return false;
86      }
87  
88      public int compareTo(Object obj) {
89          return attributeName.compareTo(((AttributeMapping) obj).attributeName);
90      }
91  
92  	public String getPropertyEditor() {
93  		return propertyEditor;
94  	}
95  }