org.apache.ws.commons.schema.walker
Class XmlSchemaTypeInfo

java.lang.Object
  extended by org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo

public final class XmlSchemaTypeInfo
extends Object

Represents an element's or attribute's type, meaning either a XmlSchemaBaseSimpleType with facets, a union or list of them, or a complex type.

Also maintains a QName representing a type the user recognizes. Users attempting to convert from one schema to another may use this to track which types in XML Schema map to their own schema types.


Nested Class Summary
static class XmlSchemaTypeInfo.Type
          What the data in this XmlSchemaTypeInfo represents.
 
Constructor Summary
XmlSchemaTypeInfo(boolean isMixed)
          Constructs a complex type whose value may or may not be mixed.
XmlSchemaTypeInfo(List<XmlSchemaTypeInfo> unionTypes)
          Constructs a union with the set of valid types a value adhering to the union must conform to.
XmlSchemaTypeInfo(List<XmlSchemaTypeInfo> unionTypes, HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
          Constructs a union with the set of valid types the a value adhering to the union must conform to, along with any constraining facets on the union itself.
XmlSchemaTypeInfo(XmlSchemaBaseSimpleType baseSimpleType)
          Constructs an atomic type with the XmlSchemaBaseSimpleType conforming values must adhere to.
XmlSchemaTypeInfo(XmlSchemaBaseSimpleType baseSimpleType, HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
          Constructs an atomic type with the XmlSchemaBaseSimpleType conforming values must adhere to, along with any additional constraining facets.
XmlSchemaTypeInfo(XmlSchemaTypeInfo listType)
          Constructs a new XmlSchemaTypeInfo representing a list of other XmlSchemaTypeInfos.
XmlSchemaTypeInfo(XmlSchemaTypeInfo listType, HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
          Constructs a list with facets.
 
Method Summary
 XmlSchemaBaseSimpleType getBaseType()
          If this represents an atomic type, returns the type.
 List<XmlSchemaTypeInfo> getChildTypes()
          If this represents a list or a union, returns the set of children types.
 HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> getFacets()
          The set of constraining facets on the value, or null if none.
 XmlSchemaTypeInfo.Type getType()
          The type represented by this XmlSchemaTypeInfo.
 QName getUserRecognizedType()
          The corresponding user-defined type, or null if none.
 boolean isMixed()
          If this is a complex type, returns whether its value is mixed.
 void setUserRecognizedType(QName userRecType)
          Sets the user-recognized type.
 String toString()
          A String representation of this XmlSchemaTypeInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(XmlSchemaTypeInfo listType)
Constructs a new XmlSchemaTypeInfo representing a list of other XmlSchemaTypeInfos. Lists are homogeneous, so only one type is necessary.

Lists may be either of atomic types or unions of atomic types. Lists of lists are not allowed.

Parameters:
listType - The list's type.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(XmlSchemaTypeInfo listType,
                         HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
Constructs a list with facets. Lists may be constrained by their length; meaning they may have a XmlSchemaRestriction.Type.LENGTH facet, a XmlSchemaRestriction.Type.LENGTH_MIN facet, or a XmlSchemaRestriction.Type.LENGTH_MAX facet (or both LENGTH_MIN and LENGTH_MAX).

Parameters:
listType - The list type.
facets - Constraining facets on the list itself.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(List<XmlSchemaTypeInfo> unionTypes)
Constructs a union with the set of valid types a value adhering to the union must conform to.

A union may either be of a set of atomic types or a set of list types, but not mixed between the two. A union of list types cannot be a type of a list.

Parameters:
unionTypes - The set of types that a value may adhere to in order to conform to the union.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(List<XmlSchemaTypeInfo> unionTypes,
                         HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
Constructs a union with the set of valid types the a value adhering to the union must conform to, along with any constraining facets on the union itself.

Parameters:
unionTypes - The set of types that a value must adhere to.
facets - Constraining facets on the union.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(XmlSchemaBaseSimpleType baseSimpleType)
Constructs an atomic type with the XmlSchemaBaseSimpleType conforming values must adhere to.

Parameters:
baseSimpleType - The value type.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(XmlSchemaBaseSimpleType baseSimpleType,
                         HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> facets)
Constructs an atomic type with the XmlSchemaBaseSimpleType conforming values must adhere to, along with any additional constraining facets.

Parameters:
baseSimpleType - The value type.
facets - The constraining facets on the value.

XmlSchemaTypeInfo

public XmlSchemaTypeInfo(boolean isMixed)
Constructs a complex type whose value may or may not be mixed.

Parameters:
isMixed - Whether the element is a mixed type.
Method Detail

getFacets

public HashMap<XmlSchemaRestriction.Type,List<XmlSchemaRestriction>> getFacets()
The set of constraining facets on the value, or null if none.


getBaseType

public XmlSchemaBaseSimpleType getBaseType()
If this represents an atomic type, returns the type. If this is a complex type, returns XmlSchemaBaseSimpleType.ANYTYPE.


getType

public XmlSchemaTypeInfo.Type getType()
The type represented by this XmlSchemaTypeInfo.


getChildTypes

public List<XmlSchemaTypeInfo> getChildTypes()
If this represents a list or a union, returns the set of children types. (Lists will only have one child type.)

Otherwise, returns null.


getUserRecognizedType

public QName getUserRecognizedType()
The corresponding user-defined type, or null if none.


isMixed

public boolean isMixed()
If this is a complex type, returns whether its value is mixed. Otherwise, returns false.


setUserRecognizedType

public void setUserRecognizedType(QName userRecType)
Sets the user-recognized type.

Parameters:
userRecType - The user-recognized type.

toString

public String toString()
A String representation of this XmlSchemaTypeInfo.

Overrides:
toString in class Object


Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.