Package gnu.kawa.xml
Class ElementType
- java.lang.Object
-
- gnu.bytecode.Type
-
- gnu.bytecode.ObjectType
-
- gnu.kawa.xml.NodeType
-
- gnu.kawa.xml.ElementType
-
- All Implemented Interfaces:
TypeValue
,ElementPredicate
,ItemPredicate
,NodePredicate
,Externalizable
,Serializable
,Type
public class ElementType extends NodeType implements TypeValue, Externalizable, ElementPredicate
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gnu.bytecode.Type
Type.NeverReturns
-
-
Field Summary
Fields Modifier and Type Field Description static ElementType
anyElement
static 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, booleanType, booleanValue_method, byte_type, byteType, char_type, charType, clone_method, double_type, doubleType, doubleValue_method, errorType, float_type, floatType, floatValue_method, int_type, intType, intValue_method, java_lang_Class_type, javalangannotationAnnotationType, javalangBooleanType, javalangCharacterType, javalangClassType, javalanginvokeMethodHandleType, javalangNumberType, javalangObjectType, javalangStringType, javalangThrowableType, long_type, longType, longValue_method, neverReturnsType, nullType, number_type, objectType, pointer_type, reflectClass, short_type, shortType, string_type, throwable_type, toString_method, tostring_type, toStringType, typeArray0, void_type, voidType
-
-
Constructor Summary
Constructors Constructor Description ElementType(Symbol qname)
ElementType(String name, Symbol qname)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KElement
coerce(Object obj, String namespaceURI, String localName)
Object
coerceFromObject(Object obj)
Convert an object to a value of this Type.static KElement
coerceOrNull(Object obj, String namespaceURI, 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()
Return Java-level implementation type.String
getLocalName()
NamespaceBinding
getNamespaceNodes()
String
getNamespaceURI()
boolean
isInstance(AbstractSequence seq, int ipos, Object elementType)
boolean
isInstance(Object obj)
boolean
isInstancePos(AbstractSequence seq, int ipos)
static ElementType
make(Symbol qname)
static ElementType
make(String namespaceURI, String localName)
An element type for match by name.void
readExternal(ObjectInput in)
void
setNamespaceNodes(NamespaceBinding bindings)
String
toString()
void
writeExternal(ObjectOutput out)
-
Methods inherited from class gnu.kawa.xml.NodeType
coerceForce, coerceOrNull, compare, convertValue, emitIsInstance, emitTestIf, isInstance
-
Methods inherited from class gnu.bytecode.ObjectType
getContextClass, getContextClassLoader, getField, getInterfaces, getInternalName, getMethod, getMethods, getMethods, getReflectClass, getSuperclass, isExisting, setExisting
-
Methods inherited from class gnu.bytecode.Type
coerceToObject, emitCoerceToObject, emitConvertFromPrimitive, emitIsInstance, getGenericSignature, getMaybeGenericSignature, getName, getRawType, getRealType, getSignature, getSize, getSizeInWords, getType, hashCode, isCompatibleWithValue, isCompatibleWithValue, isInterface, isMoreSpecific, isSame, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSharedType, lowestCommonSuperType, make, make, printSignature, promote, promoteIfUnsigned, registerTypeForClass, setGenericSignature, 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 java.lang.reflect.Type
getTypeName
-
Methods inherited from interface gnu.expr.TypeValue
convertValue, emitIsInstance, emitTestIf, encodeType
-
-
-
-
Field Detail
-
MATCH_ANY_LOCALNAME
public static final 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
-
-
Method Detail
-
make
public static ElementType make(String namespaceURI, 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
Return Java-level implementation type. The type used to implement types not natively understood by the JVM or the Java language. 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 Java level, and known at compile time.- Specified by:
getImplementationType
in interfaceTypeValue
- Overrides:
getImplementationType
in classNodeType
-
getNamespaceURI
public final String getNamespaceURI()
-
getLocalName
public final 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 classNodeType
-
coerceFromObject
public Object coerceFromObject(Object obj)
Description copied from class:Type
Convert an object to a value of this Type. The result is actually of the implementation type, boxed as appropriate, so it is suitable for standard reflective operations, like the arguments to Field#set or Method#invoke. Throw a ClassCastException when this is not possible.- Overrides:
coerceFromObject
in classNodeType
-
isInstancePos
public boolean isInstancePos(AbstractSequence seq, int ipos)
- Specified by:
isInstancePos
in interfaceItemPredicate
- Overrides:
isInstancePos
in classNodeType
-
isInstance
public boolean isInstance(AbstractSequence seq, int ipos, Object elementType)
- Specified by:
isInstance
in interfaceElementPredicate
-
isInstance
public boolean isInstance(Object obj)
- Overrides:
isInstance
in classNodeType
-
coerceOrNull
public static KElement coerceOrNull(Object obj, String namespaceURI, String localName)
-
emitCoerceOrNullMethod
protected void emitCoerceOrNullMethod(Variable incoming, Compilation comp)
- Overrides:
emitCoerceOrNullMethod
in classNodeType
-
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 (<init>
methods) should be used.- Specified by:
getConstructor
in interfaceTypeValue
- Overrides:
getConstructor
in classNodeType
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classNodeType
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classNodeType
- Throws:
IOException
ClassNotFoundException
-
-