Package org.apache.cxf.aegis.type
Class TypeUtil
java.lang.Object
org.apache.cxf.aegis.type.TypeUtil
Static methods/constants for Aegis.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AegisTypegetReadType(XMLStreamReader xsr, AegisContext context, AegisType baseType) static AegisTypegetReadTypeStandalone(XMLStreamReader xsr, AegisContext context, AegisType baseType) getReadType cannot just look up the xsi:type in the mapping.static TypegetSingleTypeParameter(Type type) Insist that a Type is a parameterized type of one parameter.static TypegetSingleTypeParameter(Type type, int index) Insist that a Type is a parameterized type of one parameter.static Class<?>getTypeClass(Type type, boolean throwForNonClass) Utility function to cast a Type to a Class.static Class<?>getTypeRelatedClass(Type type) If a Type is a class, return it as a class.static AegisTypegetWriteType(AegisContext globalContext, Object value, AegisType type) static AegisTypegetWriteTypeStandalone(AegisContext globalContext, Object value, Type reflectType) Allow writing of collections when the type of the collection object is known via anTypeobject.static AegisTypegetWriteTypeStandalone(AegisContext globalContext, Object value, AegisType type) static voidsetAttributeAttributes(QName name, AegisType type, org.apache.ws.commons.schema.XmlSchema root)
-
Method Details
-
getReadType
-
getReadTypeStandalone
public static AegisType getReadTypeStandalone(XMLStreamReader xsr, AegisContext context, AegisType baseType) getReadType cannot just look up the xsi:type in the mapping. This function must be called instead at the root where there is no initial mapping to start from, as from a part or an element of some containing item.- Parameters:
xsr-context-- Returns:
-
getWriteType
-
getWriteTypeStandalone
public static AegisType getWriteTypeStandalone(AegisContext globalContext, Object value, AegisType type) -
getWriteTypeStandalone
public static AegisType getWriteTypeStandalone(AegisContext globalContext, Object value, Type reflectType) Allow writing of collections when the type of the collection object is known via anTypeobject.- Parameters:
globalContext- the contextvalue- the object to write.reflectType- the type to use in writing the object.- Returns:
-
setAttributeAttributes
-
getTypeClass
Utility function to cast a Type to a Class. This throws an unchecked exception if the Type is not a Class. The idea here is that these Type references should have been checked for reasonableness before the point of calls to this function.- Parameters:
type- Reflection type.throwForNonClass- whether to throw (true) or return null (false) if the Type is not a class.- Returns:
- the Class
-
getSingleTypeParameter
Insist that a Type is a parameterized type of one parameter. This is used to decompose Holders, for example.- Parameters:
type- the type- Returns:
- the parameter, or null if the type is not what we want.
-
getSingleTypeParameter
Insist that a Type is a parameterized type of one parameter. This is used to decompose Holders, for example.- Parameters:
type- the typeindex- which parameter- Returns:
- the parameter, or null if the type is not what we want.
-
getTypeRelatedClass
If a Type is a class, return it as a class. If it is a ParameterizedType, return the raw type as a class. Otherwise return null.- Parameters:
type-- Returns:
-