public class EntityTypeImpl extends java.lang.Object implements EntityType
ABSTRACT, CARDINALITY, COMPONENT_TYPE, CONSTANT, DEFAULT, DEFAULT_REF, DEFAULT_VALUE, ENTITY_TYPE, EXTENDS, FIELD, IS_KEY, NAME, ONE_OR_MANY, TYPE, VSTAMP, ZERO_OR_MANY, ZERO_OR_ONE
Constructor and Description |
---|
EntityTypeImpl(TypeStore ts,
java.io.InputStream stream)
Create a new EntityType
|
EntityTypeImpl(TypeStore ts,
org.w3c.dom.Node doc)
Create a new EntityType from a Document model
|
EntityTypeImpl(TypeStore ts,
java.lang.String schema)
Create a new EntityType
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowsChildEntities()
Does this type allow child Entities
|
boolean |
allowsComponent(EntityType t)
Does this type allow entities of the specified type?
|
boolean |
allowsReferences() |
boolean |
allowsSoftReferences() |
int |
compareTo(java.lang.Object other) |
Field |
createField(java.lang.String fieldName,
ESPK reference)
Convienence method for creating a Field based on the FieldType as
defined by this EntityType definition
|
Field |
createField(java.lang.String fieldName,
java.lang.String value)
Convienence method for creating a Field based on the FieldType as
defined by this EntityType definition
|
Field |
createField(java.lang.String fieldName,
Value[] vals)
Convienence method for creating a Field based on the FieldType as
defined by this EntityType definition
|
boolean |
equals(java.lang.Object other)
Equality is based on type name.
|
boolean |
extendsType(java.lang.String parentType) |
java.util.Collection<java.lang.String> |
getAllConstantFieldNames() |
java.util.Collection<Field> |
getAllConstantFields() |
java.util.Set<java.lang.String> |
getAllDeclaredConstantFieldNames() |
java.util.Set<java.lang.String> |
getAllDeclaredFieldNames()
Get all fields defined for this type, excluding superTypes.
|
java.util.Collection<java.lang.String> |
getAllDeclaredKeyFields() |
java.util.Collection<java.lang.String> |
getAllDefaultedFieldNames() |
java.util.Collection<java.lang.String> |
getAllFieldNames() |
javax.xml.parsers.DocumentBuilder |
getBuilder() |
Field |
getConstantField(java.lang.String fieldName)
Get the constant field with the name 'fieldName'
|
java.util.Map<java.lang.String,java.lang.Object> |
getDeclaredComponentTypes()
Get a copy of the component type map for this type
Key is component type name
Value is the cardinality of allowed occurrances under a node of this type
|
FieldType |
getFieldType(java.lang.String name)
Get the field type for the specified field name.
|
java.lang.String[] |
getKeyFieldNames() |
java.lang.String |
getName()
Get the name of this type.
|
org.w3c.dom.Element |
getRootElement() |
EntityType |
getSuperType()
Get the super type of this type.
|
int |
hashCode() |
boolean |
hasSuperType(java.lang.String candidate)
Check to see if the specified type is an ancestor of this type
|
boolean |
isAbstract()
See if this type is abstract.
|
boolean |
isCompatible(EntityType other)
Compatibility is a check that the contents of an Entity of this
type can be applied safely to the contents of an Entity of another
compatible type.
|
boolean |
isConstantField(java.lang.String fieldName) |
boolean |
isKeyField(Field f) |
boolean |
isSubType(EntityType candidate)
Check that the specified type is a subtype of this type.
|
java.lang.String |
serialize()
Deprecated.
Serialising XML to strings is evil. replaced by (write)
|
java.lang.String |
toString()
The name of the type is the preferred representation
|
protected void |
validate() |
void |
write(java.io.OutputStream os) |
static void |
write(java.io.OutputStream os,
java.lang.String encoding,
org.w3c.dom.Node node) |
public EntityTypeImpl(TypeStore ts, java.io.InputStream stream) throws EntityStoreException
ts
- A Type store from where to wire up the inheritance hierarchystream
- An input stream from where to obtain the type's definitionEntityStoreException
public EntityTypeImpl(TypeStore ts, java.lang.String schema) throws EntityStoreException
ts
- A Type store from where to wire up the inheritance hierarchyschema
- A string representing the type's definitionEntityStoreException
public EntityTypeImpl(TypeStore ts, org.w3c.dom.Node doc) throws EntityStoreException
ts
- doc
- EntityStoreException
public org.w3c.dom.Element getRootElement()
getRootElement
in interface EntityType
public javax.xml.parsers.DocumentBuilder getBuilder() throws EntityStoreException
getBuilder
in interface EntityType
EntityStoreException
protected void validate() throws EntityStoreException
EntityStoreException
public java.util.Map<java.lang.String,java.lang.Object> getDeclaredComponentTypes()
getDeclaredComponentTypes
in interface EntityType
public java.util.Set<java.lang.String> getAllDeclaredFieldNames()
getAllDeclaredFieldNames
in interface EntityType
public java.util.Set<java.lang.String> getAllDeclaredConstantFieldNames()
getAllDeclaredConstantFieldNames
in interface EntityType
public java.util.Collection<java.lang.String> getAllDeclaredKeyFields()
getAllDeclaredKeyFields
in interface EntityType
public FieldType getFieldType(java.lang.String name)
getFieldType
in interface EntityType
name
- The name of the fieldpublic boolean isConstantField(java.lang.String fieldName)
isConstantField
in interface EntityType
public boolean allowsReferences()
allowsReferences
in interface EntityType
public Field getConstantField(java.lang.String fieldName)
getConstantField
in interface EntityType
public java.util.Collection<Field> getAllConstantFields()
getAllConstantFields
in interface EntityType
public java.util.Collection<java.lang.String> getAllDefaultedFieldNames()
getAllDefaultedFieldNames
in interface EntityType
public java.util.Collection<java.lang.String> getAllFieldNames()
getAllFieldNames
in interface EntityType
public java.util.Collection<java.lang.String> getAllConstantFieldNames()
getAllConstantFieldNames
in interface EntityType
public EntityType getSuperType()
getSuperType
in interface EntityType
public boolean isAbstract()
isAbstract
in interface EntityType
public java.lang.String getName()
getName
in interface EntityType
public java.lang.String[] getKeyFieldNames()
getKeyFieldNames
in interface EntityType
public boolean allowsChildEntities()
allowsChildEntities
in interface EntityType
public boolean allowsComponent(EntityType t)
allowsComponent
in interface EntityType
t
- The candidate child typepublic void write(java.io.OutputStream os) throws java.io.IOException
write
in interface EntityType
java.io.IOException
public static void write(java.io.OutputStream os, java.lang.String encoding, org.w3c.dom.Node node) throws java.io.IOException
java.io.IOException
public java.lang.String serialize() throws EntityStoreException
serialize
in interface EntityType
EntityStoreException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isSubType(EntityType candidate)
isSubType
in interface EntityType
candidate
- The candidate typepublic boolean hasSuperType(java.lang.String candidate)
EntityType
hasSuperType
in interface EntityType
public Field createField(java.lang.String fieldName, Value[] vals) throws EntityStoreException
createField
in interface EntityType
fieldName
- The name of the field to createvals
- The initial values of the FieldEntityStoreException
- If the values are incompatible with the
type definitionpublic Field createField(java.lang.String fieldName, java.lang.String value) throws EntityStoreException
createField
in interface EntityType
fieldName
- The name of the field to createvalue
- A single data valueEntityStoreException
- If the values are incompatible with the
type definitionpublic Field createField(java.lang.String fieldName, ESPK reference) throws EntityStoreException
createField
in interface EntityType
fieldName
- The name of the field to createreference
- A single data referenceEntityStoreException
- If the values are incompatible with the
type definitionpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean isCompatible(EntityType other)
isCompatible
in interface EntityType
other
- The EntityType to compare with this one.public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public boolean isKeyField(Field f)
isKeyField
in interface EntityType
public boolean allowsSoftReferences()
allowsSoftReferences
in interface EntityType
public boolean extendsType(java.lang.String parentType)
extendsType
in interface EntityType
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel