1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.xbean.spring.generator;
18
19
20
21
22
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 }