Class TypeUtil

java.lang.Object
org.apache.cxf.aegis.type.TypeUtil

public final class TypeUtil extends Object
Static methods/constants for Aegis.
  • Method Details

    • 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 an Type object.
      Parameters:
      globalContext - the context
      value - 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 type
      index - which parameter
      Returns:
      the parameter, or null if the type is not what we want.
    • getTypeRelatedClass

      public static Class<?> getTypeRelatedClass(Type type)
      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: