gnu.kawa.xml
Class ElementType

java.lang.Object
  extended by gnu.bytecode.Type
      extended by gnu.bytecode.ObjectType
          extended by gnu.kawa.xml.NodeType
              extended by gnu.kawa.xml.ElementType
All Implemented Interfaces:
TypeValue, ElementPredicate, ItemPredicate, NodePredicate, java.io.Externalizable, java.io.Serializable

public class ElementType
extends NodeType
implements TypeValue, java.io.Externalizable, ElementPredicate

See Also:
Serialized Form

Field Summary
static ElementType anyElement
           
static java.lang.String MATCH_ANY_LOCALNAME
           
static Symbol MATCH_ANY_QNAME
           
static ClassType typeElementType
           
 
Fields inherited from class gnu.kawa.xml.NodeType
anyNodeTest, ATTRIBUTE_OK, COMMENT_OK, commentNodeTest, DOCUMENT_OK, documentNodeTest, ELEMENT_OK, nodeType, PI_OK, TEXT_OK, textNodeTest, typeKNode, typeNodeType
 
Fields inherited from class gnu.bytecode.ObjectType
flags
 
Fields inherited from class gnu.bytecode.Type
boolean_ctype, boolean_type, booleanValue_method, byte_type, char_type, clone_method, double_type, doubleValue_method, float_type, floatValue_method, int_type, intValue_method, java_lang_Class_type, long_type, longValue_method, neverReturnsType, nullType, number_type, pointer_type, reflectClass, short_type, string_type, throwable_type, toString_method, tostring_type, typeArray0, void_type
 
Constructor Summary
ElementType(java.lang.String name, Symbol qname)
           
ElementType(Symbol qname)
           
 
Method Summary
static KElement coerce(java.lang.Object obj, java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.Object coerceFromObject(java.lang.Object obj)
          Convert an object to a value of this Type.
static KElement coerceOrNull(java.lang.Object obj, java.lang.String namespaceURI, java.lang.String localName)
           
 void emitCoerceFromObject(CodeAttr code)
          Compile (in given method) cast from Object to this Type.
protected  void emitCoerceOrNullMethod(Variable incoming, Compilation comp)
           
 Procedure getConstructor()
          Get the constructor function for this type.
 Type getImplementationType()
          The type used to implement types not natively understood by the JVM.
 java.lang.String getLocalName()
           
 NamespaceBinding getNamespaceNodes()
           
 java.lang.String getNamespaceURI()
           
 boolean isInstance(AbstractSequence seq, int ipos, java.lang.Object elementType)
           
 boolean isInstance(java.lang.Object obj)
           
 boolean isInstancePos(AbstractSequence seq, int ipos)
           
static ElementType make(java.lang.String namespaceURI, java.lang.String localName)
          An element type for match by name.
static ElementType make(Symbol qname)
           
 void readExternal(java.io.ObjectInput in)
           
 void setNamespaceNodes(NamespaceBinding bindings)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.kawa.xml.NodeType
coerceForce, coerceOrNull, compare, emitIsInstance, emitTestIf, isInstance
 
Methods inherited from class gnu.bytecode.ObjectType
getInternalName, getMethods, getReflectClass, isExisting, promote, setExisting
 
Methods inherited from class gnu.bytecode.Type
coerceToObject, emitCoerceToObject, emitIsInstance, getName, getSignature, getSize, getSizeInWords, getType, hashCode, isMoreSpecific, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSuperType, make, registerTypeForClass, setName, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gnu.expr.TypeValue
emitIsInstance, emitTestIf
 

Field Detail

MATCH_ANY_LOCALNAME

public static final java.lang.String MATCH_ANY_LOCALNAME
See Also:
Constant Field Values

MATCH_ANY_QNAME

public static final Symbol MATCH_ANY_QNAME

anyElement

public static final ElementType anyElement

typeElementType

public static final ClassType typeElementType
Constructor Detail

ElementType

public ElementType(Symbol qname)

ElementType

public ElementType(java.lang.String name,
                   Symbol qname)
Method Detail

make

public static ElementType make(java.lang.String namespaceURI,
                               java.lang.String localName)
An element type for match by name.

Parameters:
localName - if null matches any local name; otherwise must be intered, and matches by identity.
namespaceURI - full name of namespace, or null for any namespace.

make

public static ElementType make(Symbol qname)

getImplementationType

public Type getImplementationType()
Description copied from class: Type
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 class NodeType

getNamespaceURI

public final java.lang.String getNamespaceURI()

getLocalName

public final java.lang.String getLocalName()

emitCoerceFromObject

public void emitCoerceFromObject(CodeAttr code)
Description copied from class: ObjectType
Compile (in given method) cast from Object to this Type.

Overrides:
emitCoerceFromObject in class NodeType

coerceFromObject

public java.lang.Object coerceFromObject(java.lang.Object obj)
Description copied from class: ObjectType
Convert an object to a value of this Type. Throw a ClassCastException when this is not possible.

Overrides:
coerceFromObject in class NodeType

isInstancePos

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

isInstance

public boolean isInstance(AbstractSequence seq,
                          int ipos,
                          java.lang.Object elementType)
Specified by:
isInstance in interface ElementPredicate

isInstance

public boolean isInstance(java.lang.Object obj)
Overrides:
isInstance in class NodeType

coerceOrNull

public static KElement coerceOrNull(java.lang.Object obj,
                                    java.lang.String namespaceURI,
                                    java.lang.String localName)

coerce

public static KElement coerce(java.lang.Object obj,
                              java.lang.String namespaceURI,
                              java.lang.String localName)

emitCoerceOrNullMethod

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

getNamespaceNodes

public NamespaceBinding getNamespaceNodes()

setNamespaceNodes

public void setNamespaceNodes(NamespaceBinding bindings)

getConstructor

public Procedure getConstructor()
Description copied from interface: TypeValue
Get the constructor function for this type. Returns null if there is no contructor function. Also returns null if this extends ClassType or ArrayType and standard Java constructors ( methods) should be used.

Specified by:
getConstructor in interface TypeValue
Overrides:
getConstructor in class NodeType

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class NodeType
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class NodeType
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Overrides:
toString in class NodeType