com.sun.xml.bind.v2.model.impl
Class RuntimeEnumLeafInfoImpl<T extends java.lang.Enum<T>,B>
java.lang.Object
com.sun.xml.bind.v2.model.impl.TypeInfoImpl<T,C,F,M>
com.sun.xml.bind.v2.model.impl.EnumLeafInfoImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
com.sun.xml.bind.v2.model.impl.RuntimeEnumLeafInfoImpl<T,B>
- All Implemented Interfaces:
- Locatable, Element<java.lang.reflect.Type,java.lang.Class>, EnumLeafInfo<java.lang.reflect.Type,java.lang.Class>, LeafInfo<java.lang.reflect.Type,java.lang.Class>, MaybeElement<java.lang.reflect.Type,java.lang.Class>, NonElement<java.lang.reflect.Type,java.lang.Class>, TypeInfo<java.lang.reflect.Type,java.lang.Class>, RuntimeEnumLeafInfo, RuntimeLeafInfo, RuntimeNonElement, RuntimeTypeInfo, Transducer<T>, java.lang.Iterable<EnumConstantImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>>
final class RuntimeEnumLeafInfoImpl<T extends java.lang.Enum<T>,B>
- extends EnumLeafInfoImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
- implements RuntimeEnumLeafInfo, Transducer<T>
|
Method Summary |
RuntimeEnumConstantImpl |
createEnumConstant(java.lang.String name,
java.lang.String literal,
java.lang.reflect.Field constant,
EnumConstantImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method> last)
|
void |
declareNamespace(T t,
XMLSerializer w)
Declares the namespace URIs used in the given value to w. |
java.lang.Class |
getClazz()
The same as TypeInfo.getType() but an EnumLeafInfo
is guaranteed to represent an enum declaration, which is a
kind of a class declaration. |
Transducer<T> |
getTransducer()
This method doesn't take the reference properties defined on
RuntimeNonElementRef into account (such as ID-ness.) |
javax.xml.namespace.QName |
getTypeName(T instance)
Transducers implicitly work against a single XML type,
but sometimes (most notably XMLGregorianCalendar,
an instance may choose different XML types. |
javax.xml.namespace.QName[] |
getTypeNames()
Returns all the type names recognized by this type for unmarshalling. |
boolean |
isDefault()
If this Transducer is the default transducer for the ValueT,
this method returns true. |
T |
parse(java.lang.CharSequence lexical)
Converts the lexical representation to a value object. |
java.lang.CharSequence |
print(T t)
Converts the given value to its lexical representation. |
boolean |
useNamespace()
If true, this Transducer doesn't declare any namespace,
and therefore Transducer.declareNamespace(Object, XMLSerializer) is no-op. |
void |
writeLeafElement(XMLSerializer w,
Name tagName,
T o,
java.lang.String fieldName)
Sends the result of the Transducer.print(Object) operation
to one of the XMLSerializer.leafElement(Name, String, String) method. |
void |
writeText(XMLSerializer w,
T t,
java.lang.String fieldName)
Sends the result of the Transducer.print(Object) operation
to one of the XMLSerializer.text(String, String) method,
but with the best representation of the value, not necessarily String. |
| Methods inherited from class com.sun.xml.bind.v2.model.impl.EnumLeafInfoImpl |
asElement, calcConstants, canBeReferencedByIDREF, getBaseType, getConstants, getElementName, getLocation, getScope, getSubstitutionHead, getType, getTypeName, isElement, isSimpleType, iterator, link |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RuntimeEnumLeafInfoImpl
RuntimeEnumLeafInfoImpl(RuntimeModelBuilder builder,
Locatable upstream,
java.lang.Class<T> enumType)
getTransducer
public Transducer<T> getTransducer()
- Description copied from interface:
RuntimeLeafInfo
- This method doesn't take the reference properties defined on
RuntimeNonElementRef into account (such as ID-ness.)
- Specified by:
getTransducer in interface RuntimeLeafInfo- Specified by:
getTransducer in interface RuntimeNonElement
- Returns:
- always non-null.
- See Also:
RuntimeNonElementRef.getTransducer()
createEnumConstant
public RuntimeEnumConstantImpl createEnumConstant(java.lang.String name,
java.lang.String literal,
java.lang.reflect.Field constant,
EnumConstantImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method> last)
- Overrides:
createEnumConstant in class EnumLeafInfoImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
getTypeNames
public javax.xml.namespace.QName[] getTypeNames()
- Description copied from interface:
RuntimeLeafInfo
- Returns all the type names recognized by this type for unmarshalling.
While conceptually this method belongs to RuntimeNonElement,
if we do that we have to put a lot of dummy implementations everywhere,
so it's placed here, where it's actually needed.
- Specified by:
getTypeNames in interface RuntimeLeafInfo
- Returns:
- Always non-null. Do not modify the returned array.
isDefault
public boolean isDefault()
- Description copied from interface:
Transducer
- If this
Transducer is the default transducer for the ValueT,
this method returns true.
Used exclusively by OptimizedTransducedAccessorFactory.get(RuntimePropertyInfo)
- Specified by:
isDefault in interface Transducer<T extends java.lang.Enum<T>>
getClazz
public java.lang.Class getClazz()
- Description copied from interface:
EnumLeafInfo
- The same as
TypeInfo.getType() but an EnumLeafInfo
is guaranteed to represent an enum declaration, which is a
kind of a class declaration.
- Specified by:
getClazz in interface EnumLeafInfo<java.lang.reflect.Type,java.lang.Class>- Specified by:
getClazz in interface RuntimeLeafInfo- Overrides:
getClazz in class EnumLeafInfoImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
- Returns:
- always non-null.
useNamespace
public boolean useNamespace()
- Description copied from interface:
Transducer
- If true, this
Transducer doesn't declare any namespace,
and therefore Transducer.declareNamespace(Object, XMLSerializer) is no-op.
It also means that the Transducer.parse(CharSequence) method
won't use the context parameter.
- Specified by:
useNamespace in interface Transducer<T extends java.lang.Enum<T>>
declareNamespace
public void declareNamespace(T t,
XMLSerializer w)
throws AccessorException
- Description copied from interface:
Transducer
- Declares the namespace URIs used in the given value to
w.
- Specified by:
declareNamespace in interface Transducer<T extends java.lang.Enum<T>>
- Parameters:
t - never be null.w - may be null if !{@link #useNamespace()}.
- Throws:
AccessorException
print
public java.lang.CharSequence print(T t)
throws AccessorException
- Description copied from interface:
Transducer
- Converts the given value to its lexical representation.
- Specified by:
print in interface Transducer<T extends java.lang.Enum<T>>
- Parameters:
t - never be null.
- Returns:
- always non-null valid lexical representation.
- Throws:
AccessorException
parse
public T parse(java.lang.CharSequence lexical)
throws AccessorException,
org.xml.sax.SAXException
- Description copied from interface:
Transducer
- Converts the lexical representation to a value object.
- Specified by:
parse in interface Transducer<T extends java.lang.Enum<T>>
- Parameters:
lexical - never be null.
- Throws:
AccessorException - if the transducer is used to parse an user bean that uses XmlValue,
then this exception may occur when it tries to set the leaf value to the bean.
org.xml.sax.SAXException - if the lexical form is incorrect, the error should be reported
and SAXException may thrown (or it can return null to recover.)
writeText
public void writeText(XMLSerializer w,
T t,
java.lang.String fieldName)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.stream.XMLStreamException,
AccessorException
- Description copied from interface:
Transducer
- Sends the result of the
Transducer.print(Object) operation
to one of the XMLSerializer.text(String, String) method,
but with the best representation of the value, not necessarily String.
- Specified by:
writeText in interface Transducer<T extends java.lang.Enum<T>>
- Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.stream.XMLStreamException
AccessorException
writeLeafElement
public void writeLeafElement(XMLSerializer w,
Name tagName,
T o,
java.lang.String fieldName)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.stream.XMLStreamException,
AccessorException
- Description copied from interface:
Transducer
- Sends the result of the
Transducer.print(Object) operation
to one of the XMLSerializer.leafElement(Name, String, String) method.
but with the best representation of the value, not necessarily String.
- Specified by:
writeLeafElement in interface Transducer<T extends java.lang.Enum<T>>
- Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.stream.XMLStreamException
AccessorException
getTypeName
public javax.xml.namespace.QName getTypeName(T instance)
- Description copied from interface:
Transducer
- Transducers implicitly work against a single XML type,
but sometimes (most notably
XMLGregorianCalendar,
an instance may choose different XML types.
- Specified by:
getTypeName in interface Transducer<T extends java.lang.Enum<T>>
- Returns:
- return non-null from this method allows transducers
to specify the type it wants to marshal to.
Most of the time this method returns null, in which case
the implicitly associated type will be used.