Methods Summary |
---|
public void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list.
propertyChangeSupport.addPropertyChangeListener(listener);
|
public void | addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list for a specific property.
propertyChangeSupport.addPropertyChangeListener(property, listener);
|
protected static final java.util.Map | buildConstraintMap(java.lang.Class dataType)Creates a constraint map for the given class.
final int modifiers = Modifier.PUBLIC | Modifier.FINAL | Modifier.STATIC;
// --
Map constraintMap = new HashMap();
final Field[] fields = dataType.getFields();
Object value = null;
for (int idx = 0; idx < fields.length; idx++) {
if ((fields[idx].getModifiers() & modifiers) == modifiers) {
value = fields[idx].get(null);
if (value instanceof ObjectConstraint) {
constraintMap.put(((ObjectConstraint)value).getName(), value);
}
}
}
return Collections.unmodifiableMap(constraintMap);
|
public abstract boolean | equals(java.lang.Object obj)
|
public static oreilly.hcj.datamodeling.constraints.ObjectConstraint | getConstraint(java.lang.Class dataType, java.lang.String name)Fetch the named constraint for the given data type.
Map constraintMap = getConstraintMap(dataType);
return (ObjectConstraint)constraintMap.get(name);
|
public static final java.util.Map | getConstraintMap(java.lang.Class dataType)Return the cached constraints or index the constraints of a given class if they
aren't already indexed.
try {
Map constraintMap = (Map)CONSTRAINT_CACHE.get(dataType);
if (constraintMap == null) {
constraintMap = buildConstraintMap(dataType);
CONSTRAINT_CACHE.put(dataType, constraintMap);
return constraintMap;
}
return Collections.unmodifiableMap(constraintMap);
} catch (final IllegalAccessException ex) {
throw new RuntimeException(ex);
}
|
public abstract int | hashCode()
|
public void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener to the listener list.
propertyChangeSupport.removePropertyChangeListener(listener);
|
public void | removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener to the listener list for a specific property.
propertyChangeSupport.removePropertyChangeListener(property, listener);
|
public java.lang.String | toString(){@inheritDoc} Creates as string containing the class name and the readable
properties of the object.
try {
final BeanInfo info = Introspector.getBeanInfo(this.getClass(), Object.class);
final PropertyDescriptor[] props = info.getPropertyDescriptors();
final StringBuffer buf = new StringBuffer(500);
Object value = null;
buf.append(getClass().getName());
buf.append("@"); //$NON-NLS-1$
buf.append(hashCode());
buf.append("={"); //$NON-NLS-1$
for (int idx = 0; idx < props.length; idx++) {
if (idx != 0) {
buf.append(", "); //$NON-NLS-1$
}
buf.append(props[idx].getName());
buf.append("="); //$NON-NLS-1$
if (props[idx].getReadMethod() != null) {
value = props[idx].getReadMethod()
.invoke(this, null);
if (value instanceof MutableObject) {
buf.append("@"); //$NON-NLS-1$
buf.append(value.hashCode());
} else if (value instanceof Collection) {
buf.append("{"); //$NON-NLS-1$
for (Iterator iter = ((Collection)value).iterator();
iter.hasNext();) {
Object element = iter.next();
if (element instanceof MutableObject) {
buf.append("@"); //$NON-NLS-1$
buf.append(element.hashCode());
} else {
buf.append(element.toString());
}
}
buf.append("}"); //$NON-NLS-1$
} else if (value instanceof Map) {
buf.append("{"); //$NON-NLS-1$
Map map = (Map)value;
for (Iterator iter = map.keySet()
.iterator(); iter.hasNext();) {
Object key = iter.next();
Object element = map.get(key);
buf.append(key.toString() + "=");
if (element instanceof MutableObject) {
buf.append("@"); //$NON-NLS-1$
buf.append(element.hashCode());
} else {
buf.append(element.toString());
}
}
buf.append("}"); //$NON-NLS-1$
} else {
buf.append(value);
}
}
}
buf.append("}"); //$NON-NLS-1$
return buf.toString();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
|