org.apache.ws.jaxme.generator.sg.impl
Class SimpleTypeSGImpl

java.lang.Object
  extended by org.apache.ws.jaxme.generator.sg.impl.SimpleTypeSGImpl
All Implemented Interfaces:
SGItem, SimpleTypeSG

public class SimpleTypeSGImpl
extends java.lang.Object
implements SimpleTypeSG, SGItem


Constructor Summary
SimpleTypeSGImpl(SimpleTypeSGChain o)
           
 
Method Summary
 void addValidation(JavaMethod pMethod, DirectAccessible pValue)
          Adds code for validating the value pValue to the "add" or "set" method pMethod.
 void forAllNonNullValues(JavaMethod pMethod, java.lang.Object pValue, SGlet pSGlet)
          Invokes the given SGlet on any non null value.
 void forAllValues(JavaMethod pMethod, java.lang.Object pValue, SGlet pSGlet)
          Invokes the given SGlet on any value, assuming they are non null.
 void generate()
          Generates helper classes required by the simple type.
 void generate(JavaSource pSource)
          Generates helper classes required by the simple type.
 AtomicTypeSG getAtomicType()
          If the simple type is atomic: Returns its atomic type details.
 TypedValue getCastFromString(JavaMethod pMethod, java.lang.Object pValue, java.lang.Object pData)
          Returns a piece of Java code converting the string pValue into the runtime type.
 TypedValue getCastFromString(java.lang.String pValue)
          Returns a piece of Java code converting the string pValue into the runtime type.
 TypedValue getCastToString(JavaMethod pMethod, java.lang.Object pValue, DirectAccessible pData)
          Returns a piece of Java code converting the runtime type pValue into a string.
 java.lang.String getCollectionType()
          Returns the collection type, which is either of "indexed" (an array) or a list implementation, as specified by JAXB's property tag.
 java.lang.Object getEqualsCheck(JavaMethod pMethod, java.lang.Object pValue1, java.lang.Object pValue2)
          Returns code creating a boolean value indicating whether the given values are equal.
 Facet getFacet(Facet.Type pType)
          Returns the simple types facets with the given type or null, if no such facet exists.
 Facet[] getFacets()
          Returns all of the simple types facets.
 SGFactory getFactory()
          Returns the factory that created this item.
 SimpleTypeSGChain getHeadOfChain()
           
 java.lang.Object getInitialValue(JavaSource pSource)
          Returns the types initial value, as created by the constructor.
 ListTypeSG getListType()
          If the simple type is a list: Returns its item type details.
 org.xml.sax.Locator getLocator()
          Returns the items location in the schema; useful for error messages.
 JavaQName getRuntimeType()
          Returns the data types runtime type.
 SchemaSG getSchema()
          Returns the items schema.
 UnionTypeSG getUnionType()
          If the simple type is a union: Returns its union type details.
 JavaMethod getXMLSetMethod(JavaSource pSource, java.lang.String pFieldName, java.lang.String pParamName, java.lang.String pMethodName)
          Generates a set method for the simple type.
 boolean hasSetMethod()
          Returns whether the simple type does have a "set" method.
 void init()
          Initializes the item.
 boolean isAtomic()
          Returns whether the simple type is atomic.
 boolean isCausingParseConversionEvent()
          Returns whether converting this type from a string can cause a ParseConversionEvent.
 boolean isList()
          Returns whether the simple type is a list.
 boolean isNullable()
          Returns whether the simple type is nullable.
 boolean isUnion()
          Returns whether the simple type is a union.
 void setNullable(boolean pNullable)
          Sets whether the simple type is nullable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTypeSGImpl

public SimpleTypeSGImpl(SimpleTypeSGChain o)
Method Detail

isAtomic

public boolean isAtomic()
Description copied from interface: SimpleTypeSG

Returns whether the simple type is atomic.

Specified by:
isAtomic in interface SimpleTypeSG

isList

public boolean isList()
Description copied from interface: SimpleTypeSG

Returns whether the simple type is a list.

Specified by:
isList in interface SimpleTypeSG

isUnion

public boolean isUnion()
Description copied from interface: SimpleTypeSG

Returns whether the simple type is a union.

Specified by:
isUnion in interface SimpleTypeSG

isNullable

public boolean isNullable()
Description copied from interface: SimpleTypeSG

Returns whether the simple type is nullable.

Specified by:
isNullable in interface SimpleTypeSG

setNullable

public void setNullable(boolean pNullable)
Description copied from interface: SimpleTypeSG

Sets whether the simple type is nullable.

Specified by:
setNullable in interface SimpleTypeSG

getAtomicType

public AtomicTypeSG getAtomicType()
Description copied from interface: SimpleTypeSG

If the simple type is atomic: Returns its atomic type details.

Specified by:
getAtomicType in interface SimpleTypeSG

getListType

public ListTypeSG getListType()
Description copied from interface: SimpleTypeSG

If the simple type is a list: Returns its item type details.

Specified by:
getListType in interface SimpleTypeSG

getUnionType

public UnionTypeSG getUnionType()
Description copied from interface: SimpleTypeSG

If the simple type is a union: Returns its union type details.

Specified by:
getUnionType in interface SimpleTypeSG

getRuntimeType

public JavaQName getRuntimeType()
Description copied from interface: SimpleTypeSG

Returns the data types runtime type.

Specified by:
getRuntimeType in interface SimpleTypeSG

isCausingParseConversionEvent

public boolean isCausingParseConversionEvent()
Description copied from interface: SimpleTypeSG
Returns whether converting this type from a string can cause a ParseConversionEvent.

Specified by:
isCausingParseConversionEvent in interface SimpleTypeSG

getCastFromString

public TypedValue getCastFromString(JavaMethod pMethod,
                                    java.lang.Object pValue,
                                    java.lang.Object pData)
                             throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns a piece of Java code converting the string pValue into the runtime type. Conversion occurs at runtime, using the given instance of JMUnmarshallerHandler.

Specified by:
getCastFromString in interface SimpleTypeSG
Parameters:
pMethod - The method performing the type convertion.
pValue - The value being casted
pData - A piece of Java code holding an instance of JMUnmarshallerHandler; may be used to support the conversion.
Throws:
org.xml.sax.SAXException

getCastToString

public TypedValue getCastToString(JavaMethod pMethod,
                                  java.lang.Object pValue,
                                  DirectAccessible pData)
                           throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns a piece of Java code converting the runtime type pValue into a string. Conversion occurs at runtime, using the given instance of JMUnmarshallerHandlerImpl.

Specified by:
getCastToString in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getCastFromString

public TypedValue getCastFromString(java.lang.String pValue)
                             throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns a piece of Java code converting the string pValue into the runtime type. Conversion occurs at compile time.

Specified by:
getCastFromString in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

hasSetMethod

public boolean hasSetMethod()
                     throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns whether the simple type does have a "set" method.

Specified by:
hasSetMethod in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getCollectionType

public java.lang.String getCollectionType()
Description copied from interface: SimpleTypeSG

Returns the collection type, which is either of "indexed" (an array) or a list implementation, as specified by JAXB's property tag.

Specified by:
getCollectionType in interface SimpleTypeSG

getFacets

public Facet[] getFacets()
Description copied from interface: SimpleTypeSG

Returns all of the simple types facets.

Specified by:
getFacets in interface SimpleTypeSG

getFacet

public Facet getFacet(Facet.Type pType)
Description copied from interface: SimpleTypeSG

Returns the simple types facets with the given type or null, if no such facet exists.

Specified by:
getFacet in interface SimpleTypeSG

forAllValues

public void forAllValues(JavaMethod pMethod,
                         java.lang.Object pValue,
                         SGlet pSGlet)
                  throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Invokes the given SGlet on any value, assuming they are non null.

Specified by:
forAllValues in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

forAllNonNullValues

public void forAllNonNullValues(JavaMethod pMethod,
                                java.lang.Object pValue,
                                SGlet pSGlet)
                         throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Invokes the given SGlet on any non null value.

Specified by:
forAllNonNullValues in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

generate

public void generate()
              throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Generates helper classes required by the simple type.

Specified by:
generate in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

generate

public void generate(JavaSource pSource)
              throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Generates helper classes required by the simple type. The generated classes are inner classes of the given.

Specified by:
generate in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getEqualsCheck

public java.lang.Object getEqualsCheck(JavaMethod pMethod,
                                       java.lang.Object pValue1,
                                       java.lang.Object pValue2)
                                throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns code creating a boolean value indicating whether the given values are equal.

Specified by:
getEqualsCheck in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getInitialValue

public java.lang.Object getInitialValue(JavaSource pSource)
                                 throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Returns the types initial value, as created by the constructor.

Specified by:
getInitialValue in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getXMLSetMethod

public JavaMethod getXMLSetMethod(JavaSource pSource,
                                  java.lang.String pFieldName,
                                  java.lang.String pParamName,
                                  java.lang.String pMethodName)
                           throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Generates a set method for the simple type.

Specified by:
getXMLSetMethod in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

addValidation

public void addValidation(JavaMethod pMethod,
                          DirectAccessible pValue)
                   throws org.xml.sax.SAXException
Description copied from interface: SimpleTypeSG

Adds code for validating the value pValue to the "add" or "set" method pMethod.

Specified by:
addValidation in interface SimpleTypeSG
Throws:
org.xml.sax.SAXException

getFactory

public SGFactory getFactory()
Description copied from interface: SGItem

Returns the factory that created this item.

Specified by:
getFactory in interface SGItem

getSchema

public SchemaSG getSchema()
Description copied from interface: SGItem

Returns the items schema.

Specified by:
getSchema in interface SGItem

getLocator

public org.xml.sax.Locator getLocator()
Description copied from interface: SGItem

Returns the items location in the schema; useful for error messages.

Specified by:
getLocator in interface SGItem

init

public void init()
          throws org.xml.sax.SAXException
Description copied from interface: SGItem

Initializes the item.

Specified by:
init in interface SGItem
Throws:
org.xml.sax.SAXException

getHeadOfChain

public SimpleTypeSGChain getHeadOfChain()