org.apache.ws.jaxme.generator.sg

Interface SimpleTypeSG

public interface SimpleTypeSG extends SGItem

Interface of a source generator for complex types.

Author: Jochen Wiedmann

Method Summary
voidaddValidation(JavaMethod pMethod, DirectAccessible pValue)

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

voidforAllNonNullValues(JavaMethod pMethod, Object pValue, SGlet pSGlet)

Invokes the given {@link SGlet} on any non null value.

voidforAllValues(JavaMethod pMethod, Object pValue, SGlet pSGlet)

Invokes the given {@link SGlet} on any value, assuming they are non null.

voidgenerate()

Generates helper classes required by the simple type.

voidgenerate(JavaSource pSource)

Generates helper classes required by the simple type.

AtomicTypeSGgetAtomicType()

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

TypedValuegetCastFromString(JavaMethod pMethod, Object pValue, Object pData)

Returns a piece of Java code converting the string pValue into the runtime type.

TypedValuegetCastFromString(String pValue)

Returns a piece of Java code converting the string pValue into the runtime type.

TypedValuegetCastToString(JavaMethod pMethod, Object pValue, DirectAccessible pData)

Returns a piece of Java code converting the runtime type pValue into a string.

StringgetCollectionType()

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

ObjectgetEqualsCheck(JavaMethod pMethod, Object pValue1, Object pValue2)

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

FacetgetFacet(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.

ObjectgetInitialValue(JavaSource pSource)

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

ListTypeSGgetListType()

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

JavaQNamegetRuntimeType()

Returns the data types runtime type.

UnionTypeSGgetUnionType()

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

JavaMethodgetXMLSetMethod(JavaSource pSource, String pFieldName, String pParamName, String pMethodName)

Generates a set method for the simple type.

booleanhasSetMethod()

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

booleanisAtomic()

Returns whether the simple type is atomic.

booleanisCausingParseConversionEvent()
Returns whether converting this type from a string can cause a {@link javax.xml.bind.ParseConversionEvent}.
booleanisList()

Returns whether the simple type is a list.

booleanisNullable()

Returns whether the simple type is nullable.

booleanisUnion()

Returns whether the simple type is a union.

voidsetNullable(boolean pNullable)

Sets whether the simple type is nullable.

Method Detail

addValidation

public void addValidation(JavaMethod pMethod, DirectAccessible pValue)

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

forAllNonNullValues

public void forAllNonNullValues(JavaMethod pMethod, Object pValue, SGlet pSGlet)

Invokes the given {@link SGlet} on any non null value.

forAllValues

public void forAllValues(JavaMethod pMethod, Object pValue, SGlet pSGlet)

Invokes the given {@link SGlet} on any value, assuming they are non null.

generate

public void generate()

Generates helper classes required by the simple type.

generate

public void generate(JavaSource pSource)

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

getAtomicType

public AtomicTypeSG getAtomicType()

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

getCastFromString

public TypedValue getCastFromString(JavaMethod pMethod, Object pValue, Object pData)

Returns a piece of Java code converting the string pValue into the runtime type. Conversion occurs at runtime, using the given instance of {@link org.apache.ws.jaxme.JMUnmarshallerHandler}.

Parameters: pMethod The method performing the type convertion. pValue The value being casted pData A piece of Java code holding an instance of {@link org.apache.ws.jaxme.JMUnmarshallerHandler}; may be used to support the conversion.

getCastFromString

public TypedValue getCastFromString(String pValue)

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

getCastToString

public TypedValue getCastToString(JavaMethod pMethod, Object pValue, DirectAccessible pData)

Returns a piece of Java code converting the runtime type pValue into a string. Conversion occurs at runtime, using the given instance of {@link org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl}.

getCollectionType

public String getCollectionType()

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

getEqualsCheck

public Object getEqualsCheck(JavaMethod pMethod, Object pValue1, Object pValue2)

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

getFacet

public Facet getFacet(Facet.Type pType)

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

getFacets

public Facet[] getFacets()

Returns all of the simple types facets.

getInitialValue

public Object getInitialValue(JavaSource pSource)

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

getListType

public ListTypeSG getListType()

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

Throws: IllegalStateException The type is no list.

getRuntimeType

public JavaQName getRuntimeType()

Returns the data types runtime type.

getUnionType

public UnionTypeSG getUnionType()

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

Throws: IllegalStateException The type is no union.

getXMLSetMethod

public JavaMethod getXMLSetMethod(JavaSource pSource, String pFieldName, String pParamName, String pMethodName)

Generates a set method for the simple type.

hasSetMethod

public boolean hasSetMethod()

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

isAtomic

public boolean isAtomic()

Returns whether the simple type is atomic.

isCausingParseConversionEvent

public boolean isCausingParseConversionEvent()
Returns whether converting this type from a string can cause a {@link javax.xml.bind.ParseConversionEvent}.

isList

public boolean isList()

Returns whether the simple type is a list.

isNullable

public boolean isNullable()

Returns whether the simple type is nullable.

isUnion

public boolean isUnion()

Returns whether the simple type is a union.

setNullable

public void setNullable(boolean pNullable)

Sets whether the simple type is nullable.