Package org.apache.cxf.aegis.type
Class TypeUtil
- java.lang.Object
-
- org.apache.cxf.aegis.type.TypeUtil
-
public final class TypeUtil extends Object
Static methods/constants for Aegis.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
getReadType
public static AegisType getReadType(XMLStreamReader xsr, AegisContext context, AegisType baseType)
-
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
public static AegisType getWriteType(AegisContext globalContext, Object value, AegisType type)
-
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
public static void setAttributeAttributes(QName name, AegisType type, org.apache.ws.commons.schema.XmlSchema root)
-
getTypeClass
public static Class<?> getTypeClass(Type type, boolean throwForNonClass)
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
public static Type getSingleTypeParameter(Type type)
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
public static Type getSingleTypeParameter(Type type, int index)
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.
-
-