- private static final class GeneratedPropertyImpl implements
- GeneratedProperty {
-
- private final String name;
- private List<AnnotationType> annotations;
- private final String comment;
- private final Type parent;
- private final Type returnType;
- private final boolean isFinal;
- private final boolean isReadOnly;
- private final List<MethodSignature.Parameter> parameters;
- private final AccessModifier modifier;
-
- public GeneratedPropertyImpl(final String name, final String comment,
- final List<AnnotationTypeBuilder> annotationBuilders, final Type parent, final Type returnType,
- final boolean isFinal, final boolean isReadOnly,
- final List<Parameter> parameters, final AccessModifier modifier) {
- super();
- this.name = name;
- this.annotations = new ArrayList<AnnotationType>();
- for (final AnnotationTypeBuilder builder : annotationBuilders) {
- this.annotations.add(builder.toInstance());
- }
- this.annotations = Collections.unmodifiableList(this.annotations);
- this.comment = comment;
- this.parent = parent;
- this.returnType = returnType;
- this.isFinal = isFinal;
- this.isReadOnly = isReadOnly;
- this.parameters = Collections.unmodifiableList(parameters);
- this.modifier = modifier;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getComment() {
- return comment;
- }
-
- @Override
- public Type getDefiningType() {
- return parent;
- }
-
- @Override
- public List<AnnotationType> getAnnotations() {
- return annotations;
- }
-
- @Override
- public Type getReturnType() {
- return returnType;
- }
-
- @Override
- public List<Parameter> getParameters() {
- return parameters;
- }
-
- @Override
- public AccessModifier getAccessModifier() {
- return modifier;
- }
-
- @Override
- public boolean isReadOnly() {
- return isReadOnly;
- }
-
- @Override
- public boolean isFinal() {
- return isFinal;
- }
-
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result
- + ((parameters == null) ? 0 : parameters.hashCode());
- result = prime * result
- + ((returnType == null) ? 0 : returnType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- GeneratedPropertyImpl other = (GeneratedPropertyImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (parameters == null) {
- if (other.parameters != null) {
- return false;
- }
- } else if (!parameters.equals(other.parameters)) {
- return false;
- }
- if (returnType == null) {
- if (other.returnType != null) {
- return false;
- }
- } else if (!returnType.getPackageName().equals(other.returnType.getPackageName())) {
- return false;
- } else if (!returnType.getName().equals(other.returnType.getName())) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("GeneratedPropertyImpl [name=");
- builder.append(name);
- builder.append(", annotations=");
- builder.append(annotations);
- builder.append(", comment=");
- builder.append(comment);
- if (parent != null) {
- builder.append(", parent=");
- builder.append(parent.getPackageName());
- builder.append(".");
- builder.append(parent.getName());
- } else {
- builder.append(", parent=null");
- }
- builder.append(", returnType=");
- builder.append(returnType);
- builder.append(", isFinal=");
- builder.append(isFinal);
- builder.append(", isReadOnly=");
- builder.append(isReadOnly);
- builder.append(", parameters=");
- builder.append(parameters);
- builder.append(", modifier=");
- builder.append(modifier);
- builder.append("]");
- return builder.toString();
- }