Top Description Inners Fields Constructors Methods
com.sun.msv.reader.datatype.xsd

public Class XSDatatypeExp

extends ReferenceExp
implements BackPatch
Class Inheritance
All Implemented Interfaces
com.sun.msv.reader.GrammarReader.BackPatch
Annotations
@SuppressWarnings:serial
Imports
java.util.Collection, .Iterator, .Stack, .Vector, org.relaxng.datatype.DatatypeException, .ValidationContext, org.xml.sax.Locator, com.sun.msv.datatype.xsd.DatatypeFactory, .FinalComponent, .StringType, .TypeIncubator, .XSDatatype, .XSDatatypeImpl, com.sun.msv.grammar.ExpressionPool, .ReferenceExp, com.sun.msv.reader.GrammarReader, .State

A wrapper of XSDatatype that serves as an expression and encapsulates lazy-constructed datatypes.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
XSDatatypeExp.Renderer

this object renders the actual datatype object.

public static class
XSDatatypeExp.RenderingContext

this object is used to keep the information about the dependency between late-bind datatype objects.

Field Summary

Modifier and TypeField and Description
private XSDatatype
dt

Datatype object wrapped by this expression.

private final String
namespaceUri

Namespace URI of this datatype.

private transient State
ownerState

State object that creates this late-binding object.

private ExpressionPool
pool

ExpressionPool that can be used if necessary.

private transient XSDatatypeExp.Renderer
renderer

Once the parsing is completed, this function object should be able to render the actual datatype object.

Inherited from com.sun.msv.grammar.ReferenceExp:
expname

Constructor Summary

AccessConstructor and Description
public
XSDatatypeExp(XSDatatype dt, ExpressionPool _pool)

Creates this object from existing XSDatatype.

public
XSDatatypeExp(String nsUri, String typeName, GrammarReader reader, XSDatatypeExp.Renderer _renderer)

Creates lazily created datatype.

private
XSDatatypeExp(String nsUri, String localName)

Used only for cloning

Method Summary

Modifier and TypeMethod and Description
public XSDatatypeExp
createFinalizedType(final int finalValue, GrammarReader reader)

Derives a new type by setting final values.

public XSTypeIncubator
createIncubator()

Creates an incubator so that the caller can add more facets and derive a new type.

public XSDatatypeExp
getClone()

Gets a clone of this object.

public XSDatatype
getCreatedType()

Gets a encapsulated datatype object This method can be called only after all the datatypes are created.

public State
getOwnerState()

Implements com.sun.msv.reader.GrammarReader.BackPatch.getOwnerState.

gets State object who has submitted this patch job.
public XSDatatype
getType(XSDatatypeExp.RenderingContext context)

Gets the type definition.

public final boolean
public static XSDatatypeExp
makeList(final String nsUri, final String typeName, final XSDatatypeExp itemType, GrammarReader reader)

Derives a new type by list.

public static XSDatatypeExp
makeUnion(final String typeNameUri, final String typeName, final Collection<E> members, GrammarReader reader)

Derives a new type by union.

public void
patch()

Implements com.sun.msv.reader.GrammarReader.BackPatch.patch.

Renders the type (GrammarReader.BackPatch implementation).
public void
redefine(XSDatatypeExp rhs)

Updates this object by copying the state from rhs

Inherited from com.sun.msv.grammar.ReferenceExp:
calcEpsilonReducibilitycalcHashCodeequalsisDefinedvisitvisitvisitvisit

Field Detail

dtback to summary
private XSDatatype dt

Datatype object wrapped by this expression. This field can be null if the datatype object is not available at this moment (say, because of the forward reference). In this case, ownerState and renderer fields are available.

namespaceUriback to summary
private final String namespaceUri

Namespace URI of this datatype. Local name is stored in the name field of ReferenceExp.

ownerStateback to summary
private transient State ownerState

State object that creates this late-binding object. The source location of this state is used for error message.

poolback to summary
private ExpressionPool pool

ExpressionPool that can be used if necessary.

rendererback to summary
private transient XSDatatypeExp.Renderer renderer

Once the parsing is completed, this function object should be able to render the actual datatype object.

Constructor Detail

XSDatatypeExpback to summary
public XSDatatypeExp(XSDatatype dt, ExpressionPool _pool)

Creates this object from existing XSDatatype.

XSDatatypeExpback to summary
public XSDatatypeExp(String nsUri, String typeName, GrammarReader reader, XSDatatypeExp.Renderer _renderer)

Creates lazily created datatype.

XSDatatypeExpback to summary
private XSDatatypeExp(String nsUri, String localName)

Used only for cloning

Method Detail

createFinalizedTypeback to summary
public XSDatatypeExp createFinalizedType(final int finalValue, GrammarReader reader)

Derives a new type by setting final values.

createIncubatorback to summary
public XSTypeIncubator createIncubator()

Creates an incubator so that the caller can add more facets and derive a new type.

getCloneback to summary
public XSDatatypeExp getClone()

Gets a clone of this object.

getCreatedTypeback to summary
public XSDatatype getCreatedType()

Gets a encapsulated datatype object This method can be called only after all the datatypes are created.

Some of the datatypes are lazily during the back-patching phase.

getOwnerStateback to summary
public State getOwnerState()

Implements com.sun.msv.reader.GrammarReader.BackPatch.getOwnerState.

Doc from com.sun.msv.reader.GrammarReader.BackPatch.getOwnerState.

gets State object who has submitted this patch job.

getTypeback to summary
public XSDatatype getType(XSDatatypeExp.RenderingContext context)

Gets the type definition. This method renders the datatype object if it's not rendered yet. Internal use only.

isLateBindback to summary
public final boolean isLateBind()
makeListback to summary
public static XSDatatypeExp makeList(final String nsUri, final String typeName, final XSDatatypeExp itemType, GrammarReader reader) throws DatatypeException

Derives a new type by list.

makeUnionback to summary
public static XSDatatypeExp makeUnion(final String typeNameUri, final String typeName, final Collection<E> members, GrammarReader reader) throws DatatypeException

Derives a new type by union.

patchback to summary
public void patch()

Implements com.sun.msv.reader.GrammarReader.BackPatch.patch.

Renders the type (GrammarReader.BackPatch implementation).

redefineback to summary
public void redefine(XSDatatypeExp rhs)

Updates this object by copying the state from rhs

com.sun.msv.reader.datatype.xsd back to summary

public Interface XSDatatypeExp.Renderer

Known Direct Implementers
com.sun.msv.reader.xmlschema.SimpleContentRestrictionState.BaseContentTypeRenderer

this object renders the actual datatype object.

Method Summary

Modifier and TypeMethod and Description
public XSDatatype

Returns:

the XSDatatype object which this LateBindDatatype object is representing. It shall not return an instance of LateBindDatatype object.
render
(XSDatatypeExp.RenderingContext
If this renderer calls the getBody method of the other LateBindDatatype objects, then this context should be passed to the getBody method. This context object is responsible for detecting recursive references.
context
)

creates (or retrieves, whatever) the actual, concrete, real XSDatatype object.

Method Detail

renderback to summary
public XSDatatype render(XSDatatypeExp.RenderingContext context) throws DatatypeException

creates (or retrieves, whatever) the actual, concrete, real XSDatatype object.

This method is typically called from the wrapUp method of the GrammarReader.

Parameters
context:XSDatatypeExp.RenderingContext

If this renderer calls the getBody method of the other LateBindDatatype objects, then this context should be passed to the getBody method. This context object is responsible for detecting recursive references.

Returns:XSDatatype

the XSDatatype object which this LateBindDatatype object is representing. It shall not return an instance of LateBindDatatype object.

Exceptions
DatatypeException:
If an error occurs during rendering, the renderer should throw a DatatypeException instead of trying to report an error by itself. The caller of this method will report an error message to the appropriate handler.
com.sun.msv.reader.datatype.xsd back to summary

public Class XSDatatypeExp.RenderingContext

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.msv.reader.datatype.xsd.XSDatatypeExp.RenderingContext

this object is used to keep the information about the dependency between late-bind datatype objects.

Consider the following schema:

<xs:simpleType name="foo">
  <xs:restriction base="bar">
    <xs:minLength value="3"/>
  </xs:restriction>
</xs:simpleType>
<xs:simpleType name="bar">
  <xs:restriction base="foo">
    <xs:minLength value="3"/>
  </xs:restriction>
</xs:simpleType>
Since two types are depending on each other, if you call the getBody method of "foo" type, it will call the getBody method of "bar" type. Then in turn it will call "foo" again. So this will result in the infinite recursion.

This context object is used to detect such condition and reports the dependency to the user.

No method is publicly accessible.

Field Summary

Modifier and TypeField and Description
private final Stack<E>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callStackback to summary
private final Stack<E> callStack

Constructor Detail

RenderingContextback to summary
pack-priv RenderingContext()