public class DAEObject
extends java.lang.Object
Base class for all JAXB generated classes.
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,DAEObject> |
idIndex
Index mapping XML ID to the corresponding element.
|
DAEObject |
parent
Reference to the parent of this object in the COLLADA document, if
any.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
properties
properties map
|
private static java.lang.String |
svnid |
protected static java.lang.String[][] |
XML_SPECIALS |
protected int |
xmlLineNumber
memo for
getXMLLineNumber() |
Constructor and Description |
---|
DAEObject() |
Modifier and Type | Method and Description |
---|---|
void |
afterUnmarshal(javax.xml.bind.Unmarshaller u,
java.lang.Object parent)
Called by JAXB unmarshal after all properties have been unmarshalled
for this object (except IDREF).
|
DAEObject |
dereferenceInstance()
If
isInstanceRef() , try to resolve the referenced entity. |
protected static java.lang.String |
etterName(java.lang.reflect.Field field,
boolean plural,
java.lang.String prefix)
Common impl of
getterName(Field, boolean) , setterName(Field, boolean) . |
java.util.List<DAEObject> |
getDAEChildElements()
Get a list of all XML child elements.
|
DAEObject |
getDAERoot()
Get the root element of the enclosing COLLADA document by following
parent pointers. |
java.lang.Object |
getFieldValue(java.lang.reflect.Field field)
getFieldValue(Field, boolean) , not plural |
java.lang.Object |
getFieldValue(java.lang.reflect.Field field,
boolean plural)
Get the value of the Java field with the given name.
|
java.lang.Object |
getFieldValue(java.lang.String fieldName)
covers
getFieldValue(String, boolean) , not plural |
java.lang.Object |
getFieldValue(java.lang.String fieldName,
boolean plural)
|
java.lang.Object |
getFieldValueSafely(java.lang.reflect.Field field)
getFieldValueSafely(Field, boolean) , not plural |
java.lang.Object |
getFieldValueSafely(java.lang.reflect.Field field,
boolean plural)
getFieldValue(Field, boolean) but also return null on
introspection error. |
java.lang.String |
getLocatorMessage()
Try to get a message fragment describing the XML document source
location of this element, if known.
|
java.lang.Object |
getProperty(java.lang.String key)
get the value of a user property
|
DAEObject |
getScopedChild(java.lang.String sid)
Look for a child element of this DAE object which has an attribute
named "sid" whose value matches the passed sid.
|
java.lang.String |
getSidSafely()
Get the COLLADA sid (scoped identifier) attribute of this elment if
any, else null.
|
static java.lang.String |
getterName(java.lang.reflect.Field field)
getterName(Field, boolean) , not plural |
static java.lang.String |
getterName(java.lang.reflect.Field field,
boolean plural)
Compute the default JAXB generated get-method name for
field.
|
int |
getXMLLineNumber()
Attempt to get the XML line number corresponding to this object.
|
java.lang.String |
getXMLStringAttributeSafely(java.lang.String name)
Get the String value of the named XML attribute if any, else null.
|
boolean |
hasIDIndex()
Check if the root element of the COLLADA document containing this
object has been indexed.
|
boolean |
hasProperty(java.lang.String key)
check if a user property is set
|
boolean |
isInstanceRef()
Try to determine if this COLLADA entity is an instance reference, such
as "instance_node".
|
int |
reIndexIDs()
(re)Index the cached XML ID to element mapping for the COLLADA document
containing this element.
|
protected int |
reIndexIDs(java.util.Map<java.lang.String,DAEObject> index)
recursive impl of
reIndexIDs() |
DAEObject |
resolveIDRef(java.lang.String idref)
Resolve an XML IDREF within the enclosing COLLADA document.
|
DAEObject |
resolveSidRef(java.lang.String sidref)
Resolve sidref globally in the enclosing COLLADA document.
|
DAEObject |
resolveSidRefFromHere(java.lang.String sidref)
resolveSidRefFromHere(String, int) , always process all
segments. |
DAEObject |
resolveSidRefFromHere(java.lang.String sidref,
int maxSegments)
Walk down the DAE element tree using
getScopedChild(java.lang.String) , resolving
sidref as if its first path element corresponded to this
element. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Set the value of a user property.
|
static java.lang.String |
setterName(java.lang.reflect.Field field)
setterName(Field, boolean) , not plural |
static java.lang.String |
setterName(java.lang.reflect.Field field,
boolean plural)
Compute the default JAXB generated set-method name for
field.
|
private static final java.lang.String svnid
public DAEObject parent
Reference to the parent of this object in the COLLADA document, if any.
This is automatically set by JAXB unmarshal in afterUnmarshal(javax.xml.bind.Unmarshaller, java.lang.Object)
.
Publicly writeable since it will need to be externally set (if needed) on objects that are consed or re-parented.
protected java.util.Map<java.lang.String,DAEObject> idIndex
Index mapping XML ID to the corresponding element.
Normally this is only non-null on the root element of the COLLADA
document. See reIndexIDs()
.
protected java.util.Map<java.lang.String,java.lang.Object> properties
protected int xmlLineNumber
getXMLLineNumber()
protected static final java.lang.String[][] XML_SPECIALS
public java.lang.Object getFieldValue(java.lang.reflect.Field field, boolean plural)
Get the value of the Java field with the given name.
java.lang.IllegalStateException
- if there was an introspection errorpublic java.lang.Object getFieldValue(java.lang.String fieldName, boolean plural)
public java.lang.Object getFieldValue(java.lang.String fieldName)
getFieldValue(String, boolean)
, not pluralpublic static java.lang.String getterName(java.lang.reflect.Field field, boolean plural)
Compute the default JAXB generated get-method name for field.
public static java.lang.String getterName(java.lang.reflect.Field field)
getterName(Field, boolean)
, not pluralpublic static java.lang.String setterName(java.lang.reflect.Field field, boolean plural)
Compute the default JAXB generated set-method name for field.
public static java.lang.String setterName(java.lang.reflect.Field field)
setterName(Field, boolean)
, not pluralprotected static java.lang.String etterName(java.lang.reflect.Field field, boolean plural, java.lang.String prefix)
Common impl of getterName(Field, boolean)
, setterName(Field, boolean)
.
public java.lang.Object getFieldValue(java.lang.reflect.Field field)
getFieldValue(Field, boolean)
, not pluralpublic java.lang.Object getFieldValueSafely(java.lang.reflect.Field field, boolean plural)
getFieldValue(Field, boolean)
but also return null on
introspection error.
public java.lang.Object getFieldValueSafely(java.lang.reflect.Field field)
getFieldValueSafely(Field, boolean)
, not pluralpublic java.lang.String getXMLStringAttributeSafely(java.lang.String name)
Get the String value of the named XML attribute if any, else null.
public java.lang.String getSidSafely()
Get the COLLADA sid (scoped identifier) attribute of this elment if any, else null.
public DAEObject getDAERoot()
Get the root element of the enclosing COLLADA document by following
parent
pointers.
public java.util.List<DAEObject> getDAEChildElements()
Get a list of all XML child elements.
public DAEObject getScopedChild(java.lang.String sid)
Look for a child element of this DAE object which has an attribute named "sid" whose value matches the passed sid.
According to the COLLADA spec, it is an error for more than one child element to have equal sid attributes. Should this occur anyway, one of the matched children will be returned, but in an unspecified order.
java.lang.IllegalStateException
- if there was an introspection error while
traversing the document treepublic boolean isInstanceRef()
Try to determine if this COLLADA entity is an instance reference, such as "instance_node".
public DAEObject dereferenceInstance()
If isInstanceRef()
, try to resolve the referenced entity.
Current impl is limited to local URL fragments that can be resolved by
resolveIDRef(java.lang.String)
.
java.lang.IllegalStateException
- if not isInstanceRef()
, no "url"
or "target" string attribute, or if the reference could not be resolved by
resolveIDRef(java.lang.String)
public boolean hasIDIndex()
Check if the root element of the COLLADA document containing this object has been indexed.
Also see reIndexIDs()
.
public int reIndexIDs()
(re)Index the cached XML ID to element mapping for the COLLADA document containing this element.
This is automatically called when JAXB calls afterUnmarshal(javax.xml.bind.Unmarshaller, java.lang.Object)
for the root element.
All parent
pointers from here to the document root must be
set.
java.lang.IllegalStateException
- if there is an ID collision or if there
was an introspection error while traversing the document treeprotected int reIndexIDs(java.util.Map<java.lang.String,DAEObject> index)
reIndexIDs()
public DAEObject resolveIDRef(java.lang.String idref)
Resolve an XML IDREF within the enclosing COLLADA document.
The resolution is based on the most recent index, see reIndexIDs()
.
All parent
pointers from here to the document root must be
set.
idref
- the IDREF, the prefix '#' and the first '/' and any following
suffix are ignored, null okjava.lang.NullPointerException
- if the document has not yet been indexedpublic DAEObject resolveSidRef(java.lang.String sidref)
Resolve sidref globally in the enclosing COLLADA document.
This is a combination of resolveIDRef(java.lang.String)
on the first path
element and resolveSidRefFromHere(java.lang.String, int)
on the rest.
All parent
pointers from here to the document root must be
set.
public DAEObject resolveSidRefFromHere(java.lang.String sidref, int maxSegments)
Walk down the DAE element tree using getScopedChild(java.lang.String)
, resolving
sidref as if its first path element corresponded to this
element.
The optional "structure member selection syntax" for the final path element is not currently supported. If the final path element contains '(' the resolution will fail. Any '.' it may contain is treated no diferently than any other character of the sid (sids can legally contain '.').
Resolving the child of any encountered instance reference (see isInstanceRef()
) is handled specially. First, the lexical child is
searched. If not found, this method attempts to dereferenceInstance()
and then search the child in the referenced
instance.
maxSegments
- only resolve at most this number of path segments, zero
or negative to process all segmentsjava.lang.IllegalStateException
- if dereferenceInstance()
encountered a problempublic DAEObject resolveSidRefFromHere(java.lang.String sidref)
resolveSidRefFromHere(String, int)
, always process all
segments.
public void afterUnmarshal(javax.xml.bind.Unmarshaller u, java.lang.Object parent)
Called by JAXB unmarshal after all properties have been unmarshalled for this object (except IDREF).
Default impl sets parent
and reIndexIDs()
for the root
element.
public int getXMLLineNumber()
Attempt to get the XML line number corresponding to this object.
Memoized.
public java.lang.String getLocatorMessage()
Try to get a message fragment describing the XML document source location of this element, if known.
public java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
Set the value of a user property.
public java.lang.Object getProperty(java.lang.String key)
public boolean hasProperty(java.lang.String key)