gnu.kawa.xml

Class AttributeType

Implemented Interfaces:
Externalizable, AttributePredicate, ElementPredicate, Externalizable, NodePredicate, TypeValue

public class AttributeType
extends NodeType
implements TypeValue, Externalizable, AttributePredicate

Matches an attribute name pattern. FIXME: ElementType and AttributeType should both inherit from a common NamedNodeType class.

Field Summary

static ClassType
typeAttributeType

Fields inherited from class gnu.kawa.xml.NodeType

ATTRIBUTE_OK, COMMENT_OK, DOCUMENT_OK, GROUP_OK, PI_OK, TEXT_OK, nodeType, typeKNode, typeNodeType

Fields inherited from class gnu.bytecode.ObjectType

flags

Fields inherited from class gnu.bytecode.Type

booleanValue_method, boolean_ctype, boolean_type, byte_type, char_type, doubleValue_method, double_type, floatValue_method, float_type, intValue_method, int_type, java_lang_Class_type, longValue_method, long_type, neverReturnsType, nullType, number_type, pointer_type, reflectClass, short_type, string_type, throwable_type, toString_method, tostring_type, typeArray0, void_type

Constructor Summary

AttributeType(String name, Symbol qname)
AttributeType(Symbol qname)

Method Summary

static SeqPosition
coerce(Object obj, String namespaceURI, String localName)
Object
coerceFromObject(Object obj)
Convert an object to a value of this Type.
static SeqPosition
coerceOrNull(Object obj, String namespaceURI, String localName)
void
emitCoerceFromObject(CodeAttr code)
Compile code to coerce/convert from Object to this type.
protected void
emitCoerceOrNullMethod(Variable incoming, Compilation comp)
Type
getImplementationType()
The type used to implement types not natively understood by the JVM.
String
getLocalName()
String
getNamespaceURI()
boolean
isInstance(Object obj)
boolean
isInstance(AbstractSequence seq, int ipos, Object attrType)
boolean
isInstancePos(AbstractSequence seq, int ipos)
static AttributeType
make(String namespaceURI, String localName)
void
readExternal(ObjectInput in)
String
toString()
void
writeExternal(ObjectOutput out)

Methods inherited from class gnu.kawa.xml.NodeType

coerceForce, coerceFromObject, coerceOrNull, emitCoerceFromObject, emitCoerceOrNullMethod, emitIsInstance, emitTestIf, getImplementationType, isInstance, isInstance, isInstancePos, readExternal, toString, writeExternal

Methods inherited from class gnu.bytecode.ObjectType

coerceFromObject, compare, emitCoerceFromObject, getImplementationType, getInternalName, getReflectClass, isExisting, promote, setExisting

Methods inherited from class gnu.bytecode.Type

coerceFromObject, coerceToObject, compare, emitCoerceFromObject, emitCoerceToObject, emitIsInstance, getImplementationType, getName, getReflectClass, getSignature, getSize, getType, hashCode, isInstance, isMoreSpecific, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSuperType, make, promote, registerTypeForClass, setName, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult, toString

Field Details

typeAttributeType

public static final ClassType typeAttributeType

Constructor Details

AttributeType

public AttributeType(String name,
                     Symbol qname)

AttributeType

public AttributeType(Symbol qname)

Method Details

coerce

public static SeqPosition coerce(Object obj,
                                 String namespaceURI,
                                 String localName)

coerceFromObject

public Object coerceFromObject(Object obj)
Convert an object to a value of this Type. Throw a ClassCastException when this is not possible.
Overrides:
coerceFromObject in interface NodeType

coerceOrNull

public static SeqPosition coerceOrNull(Object obj,
                                       String namespaceURI,
                                       String localName)

emitCoerceFromObject

public void emitCoerceFromObject(CodeAttr code)
Compile code to coerce/convert from Object to this type.
Overrides:
emitCoerceFromObject in interface NodeType

emitCoerceOrNullMethod

protected void emitCoerceOrNullMethod(Variable incoming,
                                      Compilation comp)
Overrides:
emitCoerceOrNullMethod in interface NodeType

getImplementationType

public Type getImplementationType()
The type used to implement types not natively understood by the JVM. Usually, the identity function. However, a language might handle union types or template types or type expressions calculated at run time. In that case return the type used at the JVM level, and known at compile time.
Specified by:
getImplementationType in interface TypeValue
Overrides:
getImplementationType in interface NodeType

getLocalName

public final String getLocalName()

getNamespaceURI

public final String getNamespaceURI()

isInstance

public boolean isInstance(Object obj)
Overrides:
isInstance in interface NodeType

isInstance

public boolean isInstance(AbstractSequence seq,
                          int ipos,
                          Object attrType)
Specified by:
isInstance in interface AttributePredicate

isInstancePos

public boolean isInstancePos(AbstractSequence seq,
                             int ipos)
Specified by:
isInstancePos in interface ElementPredicate
Overrides:
isInstancePos in interface NodeType

make

public static AttributeType make(String namespaceURI,
                                 String localName)

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException
Overrides:
readExternal in interface NodeType

toString

public String toString()
Overrides:
toString in interface NodeType

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException
Overrides:
writeExternal in interface NodeType