org.plasma.sdo.core
Class CoreType

java.lang.Object
  extended by org.plasma.sdo.core.CoreType
All Implemented Interfaces:
Type, PlasmaType

public class CoreType
extends java.lang.Object
implements PlasmaType

A representation of the type of a property or a data object.


Constructor Summary
CoreType(java.lang.String uri, java.lang.String typeName)
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.util.List<Property> findProperties(KeyType keyType)
          Returns the declared property from this type and its base types tagged with the given key type.
 Property findProperty(ConcurrencyType concurrencyType, ConcurrentDataFlavor dataFlavor)
          Returns the declared property from this type and its base types tagged with the given concurrency type and data flavor.
 Property findProperty(KeyType keyType)
          Returns the declared property from this type and its base types tagged with the given key type.
 Property findProperty(java.lang.String propertyName)
          Returns the declared property from this type and its base types with the given property name, or null if not exists
 java.lang.Object get(Property property)
          Returns the value of the specified instance property of this Type.
 Alias getAlias()
          Returns the alias for this type
 java.util.List<java.lang.String> getAliasNames()
          Return a list of alias names for this Type.
 java.util.List<Type> getBaseTypes()
          Returns the List of immediate base Types for this Type, or an empty list if there are no base Types.
 Classifier getClassifier()
           
 java.util.List<Property> getDeclaredProperties()
          Returns the Properties declared in this Type as opposed to those declared in base Types.
 java.util.List<Property> getDeclaredPropertiesSorted()
          Returns an alphabetically sorted list of the Properties declared in this Type as opposed to those declared in base Types.
 java.util.List<Comment> getDescription()
           
 java.lang.String getDescriptionText()
           
 java.lang.Class<?> getInstanceClass()
          Returns the Java class that this type represents or the generic data object implementation class if no provisioned implementation class is found.
 java.util.List<Property> getInstanceProperties()
          Returns a read-only List of instance Properties available on this Type.
 java.lang.String getLocalName()
          Returns the local name alias of this Type as a string.
 byte[] getLocalNameBytes()
          Returns the local name of this Type as a byte array which may be cached or lazily cached on demand.
 java.lang.String getName()
          Returns the name of the type.
 byte[] getNameBytes()
          Returns the name of this Type as a byte array which may be cached or lazily cached on demand.
 java.lang.String getPackageName()
          Returns the logical name of the model package (if any) associated with this Type as a string, or null if no package exists.
 java.lang.String getPackagePhysicalName()
          Returns the physical name alias of the model package (if any) associated with this Type as a string, or null if no physical name alias exists.
 java.lang.String getPhysicalName()
          Return the physical name for this type or null if no physical alias name exists.
 byte[] getPhysicalNameBytes()
          Returns the physical name alias of this Type as a byte array which may be cached or lazily cached on demand, or null if no physical alias name exists.
 java.util.List<Property> getProperties()
          Returns the List of the Properties of this type and all base types.
 Property getProperty(java.lang.String propertyName)
          Returns from all the Properties of this type, the property with the specified name.
 javax.xml.namespace.QName getQualifiedName()
          Return the namespace URI qualified name for this type.
 byte[] getQualifiedNameBytes()
          Returns the namespace qualified logical name of this Type as a byte array which may be cached or lazily cached on demand.
 int getQualifiedNameHashCode()
          Returns a qualified logical-name hash code for this type based on the
 javax.xml.namespace.QName getQualifiedPhysicalName()
          Return the namespace qualified physical name for this type or null if no physical alias name exists.
 byte[] getQualifiedPhysicalNameBytes()
          Returns the namespace qualified physical name of this Type as a byte array which may be cached or lazily cached on demand, or null if no physical alias name exists.
 java.util.List<Type> getSubTypes()
          Returns a list of types which specialize or inherit from this type.
 java.lang.String getURI()
          Returns the namespace URI of the type.
 byte[] getURIBytes()
          Returns the URI of this Type as a byte array which may be cached or lazily cached on demand.
 int hashCode()
           
 boolean isAbstract()
          Indicates if this Type is abstract.
 boolean isBaseType(PlasmaType other)
          Returns true if the given type is part of the (base type) ancestry for this type.
 boolean isDataType()
          Indicates if this Type specifies DataTypes (true) or DataObjects (false).
 boolean isInstance(java.lang.Object object)
          Returns whether the specified object is an instance of this type.
 boolean isOpen()
          Indicates if this Type allows any form of open content.
 boolean isRelation(PlasmaType other, AssociationPath relationPath)
          Returns true if the given type is linked or related to this type across any number of traversals or hops as qualified by the given relation path type.
 boolean isSequenced()
          Indicates if this Type specifies Sequenced DataObjects.
 boolean isSubType(PlasmaType other)
          Returns true if the given type is a specialization or inherits from this type.
 java.util.List<java.lang.Object> search(Property property)
          Collects and returns all values from this type and its base types mapped to the given instance property.
 java.lang.Class<?> toDataTypeInstanceClass(DataType dataType)
          Returns a Java primitive wrapper class for the given SDO data-type (as per the SDO Specification 2.10 Section 8.1).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoreType

public CoreType(java.lang.String uri,
                java.lang.String typeName)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns the name of the type.

Specified by:
getName in interface Type
Returns:
the type name.

getNameBytes

public byte[] getNameBytes()
Returns the name of this Type as a byte array which may be cached or lazily cached on demand.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getNameBytes in interface PlasmaType
Returns:
the name of this Type as a byte array

getQualifiedName

public javax.xml.namespace.QName getQualifiedName()
Return the namespace URI qualified name for this type. This method is provided as using a QName may be more efficient than performing string concatenations within various client contexts, particularly where hashing and hash lookups by qualified Type name are required.

Specified by:
getQualifiedName in interface PlasmaType
Returns:
the namespace URI qualified name for this type.

getQualifiedNameBytes

public byte[] getQualifiedNameBytes()
Returns the namespace qualified logical name of this Type as a byte array which may be cached or lazily cached on demand.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getQualifiedNameBytes in interface PlasmaType
Returns:
the namespace qualified logical name of this Type as a byte array

getQualifiedPhysicalName

public javax.xml.namespace.QName getQualifiedPhysicalName()
Return the namespace qualified physical name for this type or null if no physical alias name exists. This method is provided as using a QName may be more efficient, depending on the client usage context, than performing string concatenations, particularly where hashing and hash lookups by qualified Type name are required.

Specified by:
getQualifiedPhysicalName in interface PlasmaType
Returns:
the namespace qualified logical name for this type or null if no physical alias name exists.

getQualifiedNameHashCode

public int getQualifiedNameHashCode()
Returns a qualified logical-name hash code for this type based on the

Specified by:
getQualifiedNameHashCode in interface PlasmaType
Returns:
a qualified logical-name hash code for this type.

getQualifiedPhysicalNameBytes

public byte[] getQualifiedPhysicalNameBytes()
Returns the namespace qualified physical name of this Type as a byte array which may be cached or lazily cached on demand, or null if no physical alias name exists.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getQualifiedPhysicalNameBytes in interface PlasmaType
Returns:
the namespace qualified physical name of this Type as a byte array, or null if no physical alias name exists.

getURI

public java.lang.String getURI()
Returns the namespace URI of the type.

Specified by:
getURI in interface Type
Returns:
the namespace URI.

getURIBytes

public byte[] getURIBytes()
Returns the URI of this Type as a byte array which may be cached or lazily cached on demand.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getURIBytes in interface PlasmaType
Returns:
the URI of this Type as a byte array

getPhysicalName

public java.lang.String getPhysicalName()
Return the physical name for this type or null if no physical alias name exists.

Specified by:
getPhysicalName in interface PlasmaType
Returns:
the physical name for this type or null if no physical alias name exists.

getPhysicalNameBytes

public byte[] getPhysicalNameBytes()
Returns the physical name alias of this Type as a byte array which may be cached or lazily cached on demand, or null if no physical alias name exists.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getPhysicalNameBytes in interface PlasmaType
Returns:
the physical name alias of this Type as a byte array, or null if no physical alias name exists.

getLocalName

public java.lang.String getLocalName()
Description copied from interface: PlasmaType
Returns the local name alias of this Type as a string.

Specified by:
getLocalName in interface PlasmaType
Returns:
the local name alias of this Type as a string.

getLocalNameBytes

public byte[] getLocalNameBytes()
Returns the local name of this Type as a byte array which may be cached or lazily cached on demand.

Helps support Data Access Services for sparse, distributed "cloud" data stores typically storing lexicographically ordered row and column keys as uninterpreted arrays of bytes. Fast dynamic construction of such keys is important as such services may necessarily construct unique composite keys based in part on qualified or unqualified logical or physical type names.

Specified by:
getLocalNameBytes in interface PlasmaType
Returns:
the local name of this Type as a byte array

getPackageName

public java.lang.String getPackageName()
Returns the logical name of the model package (if any) associated with this Type as a string, or null if no package exists.

Specified by:
getPackageName in interface PlasmaType
Returns:
the logical name of the model package (if any) associated with this Type as a string, or null if no package exists.

getPackagePhysicalName

public java.lang.String getPackagePhysicalName()
Returns the physical name alias of the model package (if any) associated with this Type as a string, or null if no physical name alias exists. The package physical name alias is useful for various services, such as those providing access to relational data stores.

Specified by:
getPackagePhysicalName in interface PlasmaType
Returns:
the physical name alias of the model package (if any) associated with this Type as a string, or null if no physical name alias exists.

getDescription

public java.util.List<Comment> getDescription()
Specified by:
getDescription in interface PlasmaType

getDescriptionText

public java.lang.String getDescriptionText()
Specified by:
getDescriptionText in interface PlasmaType

getAlias

public Alias getAlias()
Description copied from interface: PlasmaType
Returns the alias for this type

Specified by:
getAlias in interface PlasmaType
Returns:
the alias

getClassifier

public Classifier getClassifier()
Specified by:
getClassifier in interface PlasmaType

isAbstract

public boolean isAbstract()
Indicates if this Type is abstract. If true, this Type cannot be instantiated. Abstract types cannot be used in DataObject or DataFactory create methods.

Specified by:
isAbstract in interface Type
Returns:
true if this Type is abstract.

isDataType

public boolean isDataType()
Indicates if this Type specifies DataTypes (true) or DataObjects (false). When false, any object that is an instance of this type also implements the DataObject interface. True for simple types such as Strings and numbers. For any object:
   isInstance(object) && !isDataType() implies
   DataObject.class.isInstance(object) returns true. 
 

Specified by:
isDataType in interface Type
Returns:
true if Type specifies DataTypes, false for DataObjects.

getAliasNames

public java.util.List<java.lang.String> getAliasNames()
Return a list of alias names for this Type.

Specified by:
getAliasNames in interface Type
Returns:
a list of alias names for this Type.

getBaseTypes

public java.util.List<Type> getBaseTypes()
Returns the List of immediate base Types for this Type, or an empty list if there are no base Types. XSD , , and Java extends keyword are mapped to this list.

Specified by:
getBaseTypes in interface Type
Returns:
the List of immediate base Types for this Type, or an empty list if there are no base Types.

isBaseType

public boolean isBaseType(PlasmaType other)
Returns true if the given type is part of the (base type) ancestry for this type.

Specified by:
isBaseType in interface PlasmaType
Parameters:
other - the base type candidate
Returns:
true if the given type is a base type for this type.

getSubTypes

public java.util.List<Type> getSubTypes()
Returns a list of types which specialize or inherit from this type. An empty list is returned if no sub types exist.

Specified by:
getSubTypes in interface PlasmaType
Returns:
a list of types which specialize or inherit from this type. An empty list is returned if no sub types exist.

isSubType

public boolean isSubType(PlasmaType other)
Returns true if the given type is a specialization or inherits from this type.

Specified by:
isSubType in interface PlasmaType
Parameters:
other - the sub type candidate
Returns:
true if the given type is a specialization or inherits from this type.

getDeclaredProperties

public java.util.List<Property> getDeclaredProperties()
Returns the Properties declared in this Type as opposed to those declared in base Types.

Specified by:
getDeclaredProperties in interface Type
Returns:
the Properties declared in this Type.

getDeclaredPropertiesSorted

public java.util.List<Property> getDeclaredPropertiesSorted()
Returns an alphabetically sorted list of the Properties declared in this Type as opposed to those declared in base Types. Properties are alphabetically sorted by name.

Specified by:
getDeclaredPropertiesSorted in interface PlasmaType
Returns:
the Properties declared in this Type.

getInstanceProperties

public java.util.List<Property> getInstanceProperties()
Description copied from interface: Type
Returns a read-only List of instance Properties available on this Type.

This list includes, at a minimum, any open content properties (extensions) added to the object before defining the Type's Type. Implementations may, but are not required to in the 2.1 version of SDO, provide additional instance properties.

Specified by:
getInstanceProperties in interface Type
Returns:
the List of instance Properties on this Type.

getProperties

public java.util.List<Property> getProperties()
Returns the List of the Properties of this type and all base types.

The expression

   type.getProperties().indexOf(property)
yields the property's index relative to this type. As such, these expressions are equivalent:
    dataObject.get(i)
    dataObject.get((Property)dataObject.getType().getProperties().get(i));

Specified by:
getProperties in interface Type
Returns:
the Properties of the type.
See Also:
Property.getContainingType()

get

public java.lang.Object get(Property property)
Returns the value of the specified instance property of this Type.

Specified by:
get in interface Type
Parameters:
property - one of the properties returned by getInstanceProperties().
Returns:
the value of the specified property.
See Also:
DataObject.get(Property)

search

public java.util.List<java.lang.Object> search(Property property)
Description copied from interface: PlasmaType
Collects and returns all values from this type and its base types mapped to the given instance property.

Specified by:
search in interface PlasmaType
Parameters:
property - one of the properties returned by Type.getInstanceProperties().
Returns:
all values from this type and its base types mapped to the given instance property

getProperty

public Property getProperty(java.lang.String propertyName)
Returns from all the Properties of this type, the property with the specified name. As such, these expressions are equivalent:
    dataObject.get("name")
    dataObject.get(dataObject.getType().getProperty("name"))

Specified by:
getProperty in interface Type
Returns:
the Property with the specified name. throws IllegalArgumentException if the property with the specified name is not found
See Also:
getProperties()

findProperty

public Property findProperty(java.lang.String propertyName)
Returns the declared property from this type and its base types with the given property name, or null if not exists

Specified by:
findProperty in interface PlasmaType
Parameters:
name - the property name
Returns:
the declared property from this type and its base types with the given property name, or null if not exists

findProperty

public Property findProperty(ConcurrencyType concurrencyType,
                             ConcurrentDataFlavor dataFlavor)
Description copied from interface: PlasmaType
Returns the declared property from this type and its base types tagged with the given concurrency type and data flavor.

Specified by:
findProperty in interface PlasmaType
Parameters:
concurrencyType - the concurrency type
dataFlavor - the concurrency data flavor
Returns:
the declared property from this type and its base types tagged with the given concurrency type and data flavor, or null if not exists

findProperty

public Property findProperty(KeyType keyType)
Description copied from interface: PlasmaType
Returns the declared property from this type and its base types tagged with the given key type. If more than one property is found, a warning is logged and the first property is returned.

Specified by:
findProperty in interface PlasmaType
Parameters:
keyType - the key type
Returns:
declared property from this type and its base types tagged with the given key type, or null if not exists. If more than one property is found, a warning is logged and the first property is returned.

findProperties

public java.util.List<Property> findProperties(KeyType keyType)
Description copied from interface: PlasmaType
Returns the declared property from this type and its base types tagged with the given key type.

Specified by:
findProperties in interface PlasmaType
Parameters:
keyType - the key type
Returns:
declared property from this type and its base types tagged with the given key type, or null if not exists.

getInstanceClass

public java.lang.Class<?> getInstanceClass()
Returns the Java class that this type represents or the generic data object implementation class if no provisioned implementation class is found.

Specified by:
getInstanceClass in interface Type
Returns:
the Java class that this type represents or the generic data object implementation class if no provisioned implementation class is found.

isInstance

public boolean isInstance(java.lang.Object object)
Returns whether the specified object is an instance of this type.

Specified by:
isInstance in interface Type
Parameters:
object - the object in question.
Returns:
true if the object is an instance.
See Also:
Class.isInstance(java.lang.Object)

isOpen

public boolean isOpen()
Indicates if this Type allows any form of open content. If false, dataObject.getInstanceProperties() must be the same as dataObject.getType().getProperties() for any DataObject dataObject of this Type.

Specified by:
isOpen in interface Type
Returns:
true if this Type allows open content.

isSequenced

public boolean isSequenced()
Indicates if this Type specifies Sequenced DataObjects. Sequenced DataObjects are used when the order of values between Properties must be preserved. When true, a DataObject will return a Sequence. For example,
  Sequence elements = dataObject.getSequence();
 

Specified by:
isSequenced in interface Type
Returns:
true if this Type specifies Sequenced DataObjects.

toDataTypeInstanceClass

public java.lang.Class<?> toDataTypeInstanceClass(DataType dataType)
Returns a Java primitive wrapper class for the given SDO data-type (as per the SDO Specification 2.10 Section 8.1).

Specified by:
toDataTypeInstanceClass in interface PlasmaType
Parameters:
dataType -
Returns:
the SDO Java class.

isRelation

public boolean isRelation(PlasmaType other,
                          AssociationPath relationPath)
Description copied from interface: PlasmaType
Returns true if the given type is linked or related to this type across any number of traversals or hops as qualified by the given relation path type.

Specified by:
isRelation in interface PlasmaType
Parameters:
other - the other type
relationPath - the relation path type
Returns:
true if the given type is linked or related to this type across any number of traversals or hops as qualified by the given relation path type.


Copyright © 2013. All Rights Reserved.