org.codehaus.enunciate.contract.jaxb
Class TypeDefinition

java.lang.Object
  extended by net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
      extended by net.sf.jelly.apt.decorations.declaration.DecoratedMemberDeclaration
          extended by net.sf.jelly.apt.decorations.declaration.DecoratedTypeDeclaration
              extended by net.sf.jelly.apt.decorations.declaration.DecoratedClassDeclaration
                  extended by org.codehaus.enunciate.contract.jaxb.TypeDefinition
All Implemented Interfaces:
com.sun.mirror.declaration.ClassDeclaration, com.sun.mirror.declaration.Declaration, com.sun.mirror.declaration.MemberDeclaration, com.sun.mirror.declaration.TypeDeclaration
Direct Known Subclasses:
SimpleTypeDefinition

public abstract class TypeDefinition
extends DecoratedClassDeclaration

A xml type definition.

Author:
Ryan Heaton

Field Summary
 
Fields inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
delegate, javaDoc
 
Constructor Summary
protected TypeDefinition(com.sun.mirror.declaration.ClassDeclaration delegate)
           
 
Method Summary
abstract  ValidationResult accept(Validator validator)
          Accept a validator.
protected
<M extends com.sun.mirror.declaration.MemberDeclaration>
void
addOrReplace(M memberDeclaration, List<M> memberDeclarations)
          Add the specified member declaration, or if it is already in the list (by name), replace it.
protected  void aggregatePotentialAccessors(List<com.sun.mirror.declaration.FieldDeclaration> fields, List<PropertyDeclaration> properties, DecoratedClassDeclaration clazz, AccessorFilter filter)
          Aggregate the potential accessor into their separate buckets for the given class declaration, recursively including transient superclasses.
 org.codehaus.jackson.node.ObjectNode generateExampleJson()
           
 void generateExampleXml(org.jdom.Element parent)
          Generate some example xml, appending to the specified node.
 javax.xml.bind.annotation.XmlAccessOrder getAccessorOrder()
          The default accessor order of the beans in this package.
 javax.xml.bind.annotation.XmlAccessType getAccessType()
          The default access type for the beans in this class.
 AnyElement getAnyElement()
          The "anyElement" element.
 Collection<Attribute> getAttributes()
          The attributes of this type definition.
abstract  XmlType getBaseType()
          The base type of this type definition.
 String getClientSimpleName()
          The simple name for client-side code generation.
 SortedSet<Element> getElements()
          The elements of this type definition.
protected  javax.xml.bind.annotation.XmlAccessType getInheritedAccessType(com.sun.mirror.declaration.ClassDeclaration declaration)
          Get the inherited accessor type of the given class, or null if none is found.
 String getName()
          The name of the xml type element.
 String getNamespace()
          The namespace of the xml type element.
 Schema getPackage()
           
 String[] getPropertyOrder()
          The property order of this xml type.
 QName getQname()
          The qname of this type definition.
 Set<String> getReferencedFrom()
          Set of (human-readable) locations that this type definition is referenced from.
 Schema getSchema()
          The schema for this complex type.
 Value getValue()
          The value of this type definition.
 Accessor getXmlID()
          The accessor that is the xml id of this type definition, or null if none.
 boolean isAnonymous()
          Whether this xml type is anonymous.
protected  boolean isAnyAttribute(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether the member declaration is XmlAnyAttribute.
protected  boolean isAnyElement(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether the member declaration is XmlAnyElement.
protected  boolean isAttribute(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether a declaration is an xml attribute.
 boolean isBaseObject()
          Whether this type definition is a base object (i.e.
 boolean isComplex()
          Whether this is a complex type.
protected  boolean isElementRef(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether a declaration is an xml element ref.
 boolean isEnum()
          Whether this is a enum type.
 boolean isHasAnyAttribute()
          Whether this type definition has an "anyAttribute" definition.
 boolean isSimple()
          Whether this is a simple type.
protected  boolean isUnsupported(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether a declaration is an xml-mixed property.
protected  boolean isValue(com.sun.mirror.declaration.MemberDeclaration declaration)
          Whether a declaration is an xml value.
protected  boolean isXmlTransient(com.sun.mirror.declaration.Declaration declaration)
          Whether a declaration is xml transient.
protected  List<com.sun.mirror.declaration.MemberDeclaration> loadPotentialAccessors(AccessorFilter filter)
          Load the potential accessors for this type definition.
protected  boolean overrides(DecoratedMethodDeclaration method)
          Whether the given method declaration overrides any method.
protected
<M extends com.sun.mirror.declaration.MemberDeclaration>
void
remove(M memberDeclaration, List<M> memberDeclarations)
          Remove specified member declaration from the specified list, if it exists..
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedClassDeclaration
accept, getAnnotation, getConstructors, getMethods, getSuperclass, isClass
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedTypeDeclaration
getFields, getFormalTypeParameters, getNestedTypes, getProperties, getQualifiedName, getSuperinterfaces, isAnnotatedType, isInterface, isPaired
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedMemberDeclaration
getDeclaringType
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
equals, getAnnotationMirrors, getAnnotations, getDelegate, getDocComment, getDocValue, getJavaDoc, getModifiers, getPosition, getSimpleName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.mirror.declaration.TypeDeclaration
getFields, getFormalTypeParameters, getNestedTypes, getQualifiedName, getSuperinterfaces
 
Methods inherited from interface com.sun.mirror.declaration.MemberDeclaration
getDeclaringType
 
Methods inherited from interface com.sun.mirror.declaration.Declaration
equals, getAnnotationMirrors, getDocComment, getModifiers, getPosition, getSimpleName
 

Constructor Detail

TypeDefinition

protected TypeDefinition(com.sun.mirror.declaration.ClassDeclaration delegate)
Method Detail

loadPotentialAccessors

protected List<com.sun.mirror.declaration.MemberDeclaration> loadPotentialAccessors(AccessorFilter filter)
Load the potential accessors for this type definition.

Parameters:
filter - The filter.
Returns:
the potential accessors for this type definition.

aggregatePotentialAccessors

protected void aggregatePotentialAccessors(List<com.sun.mirror.declaration.FieldDeclaration> fields,
                                           List<PropertyDeclaration> properties,
                                           DecoratedClassDeclaration clazz,
                                           AccessorFilter filter)
Aggregate the potential accessor into their separate buckets for the given class declaration, recursively including transient superclasses.

Parameters:
fields - The fields.
properties - The properties.
clazz - The class.
filter - The filter.

overrides

protected boolean overrides(DecoratedMethodDeclaration method)
Whether the given method declaration overrides any method.

Parameters:
method - The method declaration.
Returns:
Whether the given method declaration overrides any method.

addOrReplace

protected <M extends com.sun.mirror.declaration.MemberDeclaration> void addOrReplace(M memberDeclaration,
                                                                                     List<M> memberDeclarations)
Add the specified member declaration, or if it is already in the list (by name), replace it.

Parameters:
memberDeclaration - The member to add/replace.
memberDeclarations - The other members.

remove

protected <M extends com.sun.mirror.declaration.MemberDeclaration> void remove(M memberDeclaration,
                                                                               List<M> memberDeclarations)
Remove specified member declaration from the specified list, if it exists..

Parameters:
memberDeclaration - The member to remove.
memberDeclarations - The other members.

isAttribute

protected boolean isAttribute(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether a declaration is an xml attribute.

Parameters:
declaration - The declaration to check.
Returns:
Whether a declaration is an attribute.

isValue

protected boolean isValue(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether a declaration is an xml value.

Parameters:
declaration - The declaration to check.
Returns:
Whether a declaration is an value.

isElementRef

protected boolean isElementRef(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether a declaration is an xml element ref.

Parameters:
declaration - The declaration to check.
Returns:
Whether a declaration is an xml element ref.

isAnyAttribute

protected boolean isAnyAttribute(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether the member declaration is XmlAnyAttribute.

Parameters:
declaration - The declaration.
Returns:
Whether the member declaration is XmlAnyAttribute.

isAnyElement

protected boolean isAnyElement(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether the member declaration is XmlAnyElement.

Parameters:
declaration - The declaration.
Returns:
Whether the member declaration is XmlAnyElement.

isUnsupported

protected boolean isUnsupported(com.sun.mirror.declaration.MemberDeclaration declaration)
Whether a declaration is an xml-mixed property.

Parameters:
declaration - The declaration to check.
Returns:
Whether a declaration is an mixed.

getName

public String getName()
The name of the xml type element.

Returns:
The name of the xml type element.

getNamespace

public String getNamespace()
The namespace of the xml type element.

Returns:
The namespace of the xml type element.

getClientSimpleName

public String getClientSimpleName()
The simple name for client-side code generation.

Returns:
The simple name for client-side code generation.

getQname

public QName getQname()
The qname of this type definition.

Returns:
The qname of this type definition.

getAccessType

public javax.xml.bind.annotation.XmlAccessType getAccessType()
The default access type for the beans in this class.

Returns:
The default access type for the beans in this class.

getInheritedAccessType

protected javax.xml.bind.annotation.XmlAccessType getInheritedAccessType(com.sun.mirror.declaration.ClassDeclaration declaration)
Get the inherited accessor type of the given class, or null if none is found.

Parameters:
declaration - The inherited accessor type.
Returns:
The inherited accessor type of the given class, or null if none is found.

getPropertyOrder

public String[] getPropertyOrder()
The property order of this xml type.

Returns:
The property order of this xml type.

getAccessorOrder

public javax.xml.bind.annotation.XmlAccessOrder getAccessorOrder()
The default accessor order of the beans in this package.

Returns:
The default accessor order of the beans in this package.

isHasAnyAttribute

public boolean isHasAnyAttribute()
Whether this type definition has an "anyAttribute" definition.

Returns:
Whether this type definition has an "anyAttribute" definition.

getAnyElement

public AnyElement getAnyElement()
The "anyElement" element.

Returns:
The "anyElement" element.

getElements

public SortedSet<Element> getElements()
The elements of this type definition.

Returns:
The elements of this type definition.

getAttributes

public Collection<Attribute> getAttributes()
The attributes of this type definition.

Returns:
The attributes of this type definition.

getValue

public Value getValue()
The value of this type definition.

Returns:
The value of this type definition.

getXmlID

public Accessor getXmlID()
The accessor that is the xml id of this type definition, or null if none.

Returns:
The accessor that is the xml id of this type definition, or null if none.

isXmlTransient

protected boolean isXmlTransient(com.sun.mirror.declaration.Declaration declaration)
Whether a declaration is xml transient.

Parameters:
declaration - The declaration on which to determine xml transience.
Returns:
Whether a declaration is xml transient.

isAnonymous

public boolean isAnonymous()
Whether this xml type is anonymous.

Returns:
Whether this xml type is anonymous.

getSchema

public Schema getSchema()
The schema for this complex type.

Returns:
The schema for this complex type.

getPackage

public Schema getPackage()
Specified by:
getPackage in interface com.sun.mirror.declaration.TypeDeclaration
Overrides:
getPackage in class DecoratedTypeDeclaration

isComplex

public boolean isComplex()
Whether this is a complex type.

Returns:
Whether this is a complex type.

isEnum

public boolean isEnum()
Whether this is a enum type.

Overrides:
isEnum in class DecoratedTypeDeclaration
Returns:
Whether this is a enum type.

isSimple

public boolean isSimple()
Whether this is a simple type.

Returns:
Whether this is a simple type.

isBaseObject

public boolean isBaseObject()
Whether this type definition is a base object (i.e. a root of the object hierarchy).

Returns:
Whether this type definition is a base object

getReferencedFrom

public Set<String> getReferencedFrom()
Set of (human-readable) locations that this type definition is referenced from.

Returns:
The referenced-from list.

accept

public abstract ValidationResult accept(Validator validator)
Accept a validator.

Parameters:
validator - The validator to accept.
Returns:
The validation results.

getBaseType

public abstract XmlType getBaseType()
The base type of this type definition.

Returns:
The base type of this type definition.

generateExampleXml

public void generateExampleXml(org.jdom.Element parent)
Generate some example xml, appending to the specified node.

Parameters:
parent - The parent node.

generateExampleJson

public org.codehaus.jackson.node.ObjectNode generateExampleJson()