Apache CXF API

org.apache.cxf.javascript
Class ParticleInfo

java.lang.Object
  extended by org.apache.cxf.javascript.ParticleInfo
All Implemented Interfaces:
ItemInfo

public final class ParticleInfo
extends Object
implements ItemInfo

All the information needed to create the JavaScript for an Xml Schema element or xs:any.


Method Summary
static ParticleInfo forGlobalElement(org.apache.ws.commons.schema.XmlSchemaElement element, org.apache.ws.commons.schema.XmlSchema currentSchema, SchemaCollection schemaCollection, NamespacePrefixAccumulator prefixAccumulator)
          Create an elementInfo that stores information about a global, named, element.
static ParticleInfo forLocalItem(org.apache.ws.commons.schema.XmlSchemaObject sequenceObject, org.apache.ws.commons.schema.XmlSchema currentSchema, SchemaCollection schemaCollection, NamespacePrefixAccumulator prefixAccumulator, QName contextName)
          Fill in an ElementInfo for an element or xs:any from a sequence.
static ParticleInfo forPartElement(org.apache.ws.commons.schema.XmlSchemaElement element, SchemaCollection schemaCollection, String javascriptName, String xmlElementName)
          Create element information for a part element.
 org.apache.ws.commons.schema.XmlSchemaType getContainingType()
           
 QName getControllingName()
          As a general rule, the JavaScript code is organized by types.
 String getDefaultValue()
          *
 String getJavascriptName()
           
 long getMaxOccurs()
           
 long getMinOccurs()
           
 org.apache.ws.commons.schema.XmlSchemaParticle getParticle()
           
 org.apache.ws.commons.schema.XmlSchemaType getType()
           
 String getXmlName()
           
 boolean isAny()
           
 boolean isAnyType()
           
 boolean isArray()
           
 boolean isEmpty()
           
 boolean isGlobal()
          True if this describes a global, named, element.
 boolean isNillable()
           
 boolean isOptional()
           
 void setContainingType(org.apache.ws.commons.schema.XmlSchemaType containingType)
           
 void setDefaultValue(String defaultValue)
           
 void setEmpty(boolean empty)
           
 void setJavascriptName(String name)
           
 void setType(org.apache.ws.commons.schema.XmlSchemaType type)
           
 void setXmlName(String elementXmlName)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

forGlobalElement

public static ParticleInfo forGlobalElement(org.apache.ws.commons.schema.XmlSchemaElement element,
                                            org.apache.ws.commons.schema.XmlSchema currentSchema,
                                            SchemaCollection schemaCollection,
                                            NamespacePrefixAccumulator prefixAccumulator)
Create an elementInfo that stores information about a global, named, element.

Parameters:
element - the element
currentSchema - the schema it came from.
schemaCollection - the collection of all schemas.
prefixAccumulator - the accumulator that assigns prefixes.
Returns:

forPartElement

public static ParticleInfo forPartElement(org.apache.ws.commons.schema.XmlSchemaElement element,
                                          SchemaCollection schemaCollection,
                                          String javascriptName,
                                          String xmlElementName)
Create element information for a part element. For a part, the JavaScript and Element names are calculated in advance, and the element itself might be null! In that case, the minOccurs and maxOccurs are conventional. Note that in some cases the code in ServiceJavascriptBuilder uses a local element (or xa:any) from inside the part element, instead of the part element itself.

Parameters:
element - the element, or null
schemaCollection - the schema collection, for resolving types.
javascriptName - javascript variable name
xmlElementName - xml element string
Returns:

forLocalItem

public static ParticleInfo forLocalItem(org.apache.ws.commons.schema.XmlSchemaObject sequenceObject,
                                        org.apache.ws.commons.schema.XmlSchema currentSchema,
                                        SchemaCollection schemaCollection,
                                        NamespacePrefixAccumulator prefixAccumulator,
                                        QName contextName)
Fill in an ElementInfo for an element or xs:any from a sequence.

Parameters:
sequenceElement -
currentSchema -
schemaCollection -
prefixAccumulator -
Returns:

getControllingName

public QName getControllingName()
As a general rule, the JavaScript code is organized by types. The exception is global elements that have anonymous types. In those cases, the JavaScript code has its functions named according to the element. This method returns the QName for the type or element, accordingly. If a schema has a local element with an anonymous, complex, type, this will throw. This will need to be fixed.

Returns:
the qname.

getParticle

public org.apache.ws.commons.schema.XmlSchemaParticle getParticle()

getJavascriptName

public String getJavascriptName()
Specified by:
getJavascriptName in interface ItemInfo

setJavascriptName

public void setJavascriptName(String name)

getXmlName

public String getXmlName()

setXmlName

public void setXmlName(String elementXmlName)

getContainingType

public org.apache.ws.commons.schema.XmlSchemaType getContainingType()

setContainingType

public void setContainingType(org.apache.ws.commons.schema.XmlSchemaType containingType)

getType

public org.apache.ws.commons.schema.XmlSchemaType getType()
Specified by:
getType in interface ItemInfo

setType

public void setType(org.apache.ws.commons.schema.XmlSchemaType type)

isEmpty

public boolean isEmpty()

setEmpty

public void setEmpty(boolean empty)

getMinOccurs

public long getMinOccurs()

getMaxOccurs

public long getMaxOccurs()

isArray

public boolean isArray()
Specified by:
isArray in interface ItemInfo

isOptional

public boolean isOptional()
Specified by:
isOptional in interface ItemInfo

isNillable

public boolean isNillable()
Specified by:
isNillable in interface ItemInfo
Returns:
Returns the nillable flag for the element. False for 'xs:any'

isAny

public boolean isAny()
Specified by:
isAny in interface ItemInfo

isAnyType

public boolean isAnyType()

getDefaultValue

public String getDefaultValue()
*

Specified by:
getDefaultValue in interface ItemInfo
Returns:
Returns the defaultValue.

setDefaultValue

public void setDefaultValue(String defaultValue)
Specified by:
setDefaultValue in interface ItemInfo
Parameters:
defaultValue - The defaultValue to set.

isGlobal

public boolean isGlobal()
True if this describes a global, named, element.

Returns:

toString

public String toString()
Overrides:
toString in class Object

Apache CXF API

Apache CXF