/** * <p> * Tests for type equality. This is only necessary, * to handle the case where two <code>Type</code> objects * are loaded by different class loaders. * </p> * * @param o the object compared for equality to this type * * @return true if and only if <code>o</code> represents * the same type * * @see java.lang.Object#equals(Object) */ public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (this.hashCode() != o.hashCode()) return false; if (!o.getClass().getName().equals("nu.xom.Attribute.Type")) { return false; } return true; }
/** * <p> * Returns a string representation of the type * suitable for debugging and diagnosis. * </p> * * @return a non-XML string representation of this type * * @see java.lang.Object#toString() */ public String toString() { StringBuffer result = new StringBuffer("[Attribute.Type: "); result.append(getName()); result.append("]"); return result.toString(); }
/** * <p> * Sets the type of this attribute to one of the ten * DTD types or <code>Type.UNDECLARED</code>. * </p> * * @param type the DTD type of this attribute */ public void setType(Type type) { if (isXMLID() && ! Type.ID.equals(type)) { throw new IllegalDataException( "Can't change type of xml:id attribute to " + type); } _setType(type); }
/** Reuses XOM's way of representing attribute types */ public static byte getAttributeTypeCode(Attribute attr) { return (byte) attr.getType().hashCode(); }
/** Reuses XOM's way of representing attribute types */ public static byte getAttributeTypeCode(Attribute attr) { return (byte) attr.getType().hashCode(); }