wt.step.schemaGenerator
Class EntityDefinition

java.lang.Object
  extended bywt.step.schemaGenerator.EntityDefinition

class EntityDefinition
extends Object

A Schema Entity definition holding information on subtypes and attributes.


Field Summary
private  Vector _attributes
           
private  String _name
           
private  Vector _subtypes
           
private static int ROLE_CARDINALITY_ONE_TO_MANY
           
 
Constructor Summary
  EntityDefinition(ClassInfo introspectionInfo, Schema parentSchema)
          Builds an Entity definition using introspection
(package private) EntityDefinition(String entityName)
           
 
Method Summary
(package private)  void addAttribute(String name, String type)
           
private  void addAttributes(ClassInfo introspectionInfo, Schema parentSchema)
           
(package private)  void addSubtype(String subtypeName)
           
private  void addSubTypes(ClassInfo introspectionInfo, Schema parentSchema)
           
(package private)  void collectAttributes(Hashtable attributesHolder, Schema schema)
          Collect all the attributes for this Entity and any of its sub-Entities
private  void collectSubAttributes(Hashtable attributesHolder, Schema schema)
          Collect all the attributes for this Entity and any of its sub-Entities
protected  Vector getAttributes()
           
private  String getExpressNameFor(ClassInfo introspectionInfo)
           
private  String getExpressNameForField(String fieldName)
           
private  String getExpressNameForType(Class type)
           
(package private)  String getName()
           
protected  Vector getSubTypes()
           
private  boolean isNativeType(Class typeClass)
           
private  boolean isPublicDeclaredProperty(PropertyDescriptor property)
           
(package private)  void markInheritedAttributes(Schema schema)
           
(package private)  void removeAttributeNameClashes(Schema schema)
          Many attributes are repeated in subclasses.
 void writeExpress(PrintStream outStream)
          Write this Entity in Express to the given print stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_attributes

private Vector _attributes

_subtypes

private Vector _subtypes

_name

private String _name

ROLE_CARDINALITY_ONE_TO_MANY

private static final int ROLE_CARDINALITY_ONE_TO_MANY
See Also:
Constant Field Values
Constructor Detail

EntityDefinition

EntityDefinition(String entityName)

EntityDefinition

public EntityDefinition(ClassInfo introspectionInfo,
                        Schema parentSchema)
                 throws WTIntrospectionException
Builds an Entity definition using introspection

Method Detail

addSubTypes

private void addSubTypes(ClassInfo introspectionInfo,
                         Schema parentSchema)
                  throws WTIntrospectionException
Throws:
WTIntrospectionException

addAttributes

private void addAttributes(ClassInfo introspectionInfo,
                           Schema parentSchema)
                    throws WTIntrospectionException
Throws:
WTIntrospectionException

isNativeType

private boolean isNativeType(Class typeClass)

isPublicDeclaredProperty

private boolean isPublicDeclaredProperty(PropertyDescriptor property)

getExpressNameForField

private String getExpressNameForField(String fieldName)

getExpressNameForType

private String getExpressNameForType(Class type)

getExpressNameFor

private String getExpressNameFor(ClassInfo introspectionInfo)

getName

String getName()

addSubtype

void addSubtype(String subtypeName)

addAttribute

void addAttribute(String name,
                  String type)

removeAttributeNameClashes

void removeAttributeNameClashes(Schema schema)
Many attributes are repeated in subclasses. This is not valid in Express so this method checks all attributes and flags those as inherited. Inherited attributes are then commented out in the generated Express. It also possible for the same attribute name to appear twice, in which case an incremental number is appended to its name.


markInheritedAttributes

void markInheritedAttributes(Schema schema)

collectSubAttributes

private void collectSubAttributes(Hashtable attributesHolder,
                                  Schema schema)
Collect all the attributes for this Entity and any of its sub-Entities


collectAttributes

void collectAttributes(Hashtable attributesHolder,
                       Schema schema)
Collect all the attributes for this Entity and any of its sub-Entities


getSubTypes

protected Vector getSubTypes()

getAttributes

protected Vector getAttributes()

writeExpress

public void writeExpress(PrintStream outStream)
Write this Entity in Express to the given print stream.