1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
package org.springframework.ldap.odm.tools;
/**
* Simple value class to hold the schema of an attribute.
* <p>
* It is only public to allow Freemarker access.
*
* @author Paul Harvey <paul.at.pauls-place.me.uk>
*/
public final class AttributeSchema {
private final String name;
private final String syntax;
private final boolean isMultiValued;
private final boolean isPrimitive;
private final String scalarType;
private final boolean isBinary;
private final boolean isArray;
public AttributeSchema(final String name, final String syntax, final boolean isMultiValued,
final boolean isPrimitive, final boolean isBinary, final boolean isArray, final String scalarType) {
this.name = name;
this.syntax = syntax;
this.isMultiValued = isMultiValued;
this.isPrimitive = isPrimitive;
this.scalarType = scalarType;
this.isBinary = isBinary;
this.isArray = isArray;
}
public boolean getIsArray() {
return isArray;
}
public boolean getIsBinary() {
return isBinary;
}
public boolean getIsPrimitive() {
return isPrimitive;
}
public String getScalarType() {
return scalarType;
}
public String getName() {
return name;
}
public String getSyntax() {
return syntax;
}
public boolean getIsMultiValued() {
return isMultiValued;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return String.format(
"{ name=%1$s, syntax=%2$s, isMultiValued=%3$s, isPrimitive=%4$s, isBinary=%5$s, isArray=%6$s, scalarType=%7$s }",
name, syntax, isMultiValued, isPrimitive, isBinary, isArray, scalarType);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (isArray ? 1231 : 1237);
result = prime * result + (isBinary ? 1231 : 1237);
result = prime * result + (isMultiValued ? 1231 : 1237);
result = prime * result + (isPrimitive ? 1231 : 1237);
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((scalarType == null) ? 0 : scalarType.hashCode());
result = prime * result + ((syntax == null) ? 0 : syntax.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;
AttributeSchema other = (AttributeSchema) obj;
if (isArray != other.isArray)
return false;
if (isBinary != other.isBinary)
return false;
if (isMultiValued != other.isMultiValued)
return false;
if (isPrimitive != other.isPrimitive)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (scalarType == null) {
if (other.scalarType != null)
return false;
} else if (!scalarType.equals(other.scalarType))
return false;
if (syntax == null) {
if (other.syntax != null)
return false;
} else if (!syntax.equals(other.syntax))
return false;
return true;
}
}
|