|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tuscany.sdo.util.SDOUtil
public final class SDOUtil
This class provides some useful static utility functions which are not specified in the SDO specification itself. Use of the functions in this class is recommended, instead of resorting to low-level implementation-specific APIs.
Constructor Summary | |
---|---|
SDOUtil()
|
Method Summary | |
---|---|
static void |
addAliasName(commonj.sdo.Property property,
java.lang.String aliasName)
|
static void |
addAliasName(commonj.sdo.Type type,
java.lang.String aliasName)
|
static void |
addBaseType(commonj.sdo.Type type,
commonj.sdo.Type baseType)
|
static java.lang.String |
convertToString(commonj.sdo.Type dataType,
java.lang.Object value)
Converts an instance of a data type to a string literal representation. |
static commonj.sdo.helper.CopyHelper |
createCrossScopeCopyHelper(commonj.sdo.helper.TypeHelper targetScope)
Create a new cross scope CopyHelper. |
static commonj.sdo.helper.DataFactory |
createDataFactory(commonj.sdo.helper.TypeHelper scope)
Create a new DataFactory, with visibility to types in the specified TypeHelper scope. |
static commonj.sdo.DataGraph |
createDataGraph()
Create an empty data graph. |
static commonj.sdo.DataObject |
createDataTypeWrapper(commonj.sdo.Type dataType,
java.lang.Object value)
Create a DataObject wrapper for an instance of the specified dataType. |
static java.lang.Object |
createFromString(commonj.sdo.Type dataType,
java.lang.String literal)
Creates an instance of a data type from the specified string. |
static commonj.sdo.Property |
createProperty(commonj.sdo.Type containingType,
java.lang.String name,
commonj.sdo.Type propertyType)
|
static commonj.sdo.Type |
createType(commonj.sdo.helper.TypeHelper scope,
java.lang.String uri,
java.lang.String name,
boolean isDataType)
|
static commonj.sdo.helper.TypeHelper |
createTypeHelper()
Create a new TypeHelper instance. |
static commonj.sdo.helper.XMLHelper |
createXMLHelper(commonj.sdo.helper.TypeHelper scope)
Create a new XMLHelper, with visibility to types in the specified TypeHelper scope. |
static XMLStreamHelper |
createXMLStreamHelper(commonj.sdo.helper.TypeHelper scope)
Create a new XMLStreamHelper, with visibility to types in the specified TypeHelper scope. |
static commonj.sdo.helper.XSDHelper |
createXSDHelper(commonj.sdo.helper.TypeHelper scope)
Create a new XSDHelper, with visibility to types in the specified TypeHelper scope. |
static commonj.sdo.Type |
getJavaSDOType(java.lang.Class javaClass)
Get the SDO built-in type corresponding to the specified Java instanceClass. |
static commonj.sdo.Sequence |
getSubstitutionValues(commonj.sdo.DataObject dataObject,
commonj.sdo.Property head)
Gets the Sequence corresponding to the specified substitutable Property of the specified DataObject. |
static java.util.List |
getTypes(commonj.sdo.helper.TypeHelper scope,
java.lang.String uri)
Gets all of the types associated with a uri. |
static commonj.sdo.Type |
getXSDSDOType(java.lang.String xsdType)
Get the SDO built-in type corresponding to the specified XSD type in the XML Schema namespace ("http://www.w3.org/2001/XMLSchema"). |
static boolean |
isMany(commonj.sdo.Property property,
commonj.sdo.DataObject context)
Returns whether the Property is many-valued given the specified context. |
static boolean |
isRequired(commonj.sdo.Property property)
Return whether at least one value is required for a valid instance of the specified property. |
static commonj.sdo.DataGraph |
loadDataGraph(java.io.InputStream inputStream,
java.util.Map options)
Load a serialized data graph from the specified insputStream. |
static void |
registerDataGraphTypes(commonj.sdo.DataGraph dataGraph,
java.util.List types)
Registers the specified type (s) to be serialized along with
the data object (s) in the graph. |
static void |
registerStaticTypes(java.lang.Class factoryClass)
Register and initialize the SDO types supported by the specified generated factory class. |
static void |
saveDataGraph(commonj.sdo.DataGraph dataGraph,
java.io.OutputStream outputStream,
java.util.Map options)
Serialize the specified data graph to the specified outputStream. |
static void |
setAbstract(commonj.sdo.Type type,
boolean isAbstract)
|
static void |
setContainment(commonj.sdo.Property property,
boolean isContainment)
|
static void |
setDefault(commonj.sdo.Property property,
java.lang.String defaultValue)
|
static void |
setJavaClassName(commonj.sdo.Type type,
java.lang.String javaClassName)
|
static void |
setMany(commonj.sdo.Property property,
boolean isMany)
|
static void |
setOpen(commonj.sdo.Type type,
boolean isOpen)
|
static void |
setOpposite(commonj.sdo.Property property,
commonj.sdo.Property opposite)
|
static void |
setReadOnly(commonj.sdo.Property property,
boolean isReadOnly)
|
static void |
setRootObject(commonj.sdo.DataGraph dataGraph,
commonj.sdo.DataObject rootObject)
Set the root object of a data graph. |
static void |
setSequenced(commonj.sdo.Type type,
boolean isSequenced)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SDOUtil()
Method Detail |
---|
public static commonj.sdo.DataObject createDataTypeWrapper(commonj.sdo.Type dataType, java.lang.Object value)
dataType
- a Type for which isDataType() returns true.value
- the instance value.
public static java.lang.Object createFromString(commonj.sdo.Type dataType, java.lang.String literal)
dataType
- a Type, for which isDataType() returns true, to instantiate.literal
- the string value of the dataType.
convertToString(Type, Object)
public static java.lang.String convertToString(commonj.sdo.Type dataType, java.lang.Object value)
dataType
- the Type, for which isDataType() returns true, of the value to convert.value
- a value of the dataType.
createFromString(Type, String)
public static commonj.sdo.Type getXSDSDOType(java.lang.String xsdType)
xsdType
- a type name in the XML Schema namespace.
public static commonj.sdo.Sequence getSubstitutionValues(commonj.sdo.DataObject dataObject, commonj.sdo.Property head)
dataObject
- the data object.head
- a substitution group head property.
public static commonj.sdo.Type getJavaSDOType(java.lang.Class javaClass)
javaClass
- the Java instanceClass of the type.
public static boolean isRequired(commonj.sdo.Property property)
the
- property in question.
public static boolean isMany(commonj.sdo.Property property, commonj.sdo.DataObject context)
property
- The Property in questioncontext
- The context to check whether the specified Property is many-valued
public static commonj.sdo.DataGraph createDataGraph()
public static void setRootObject(commonj.sdo.DataGraph dataGraph, commonj.sdo.DataObject rootObject)
dataGraph
- the data graph in which to set the root object.rootObject
- the root object.public static commonj.sdo.DataGraph loadDataGraph(java.io.InputStream inputStream, java.util.Map options) throws java.io.IOException
inputStream
- the inputStream of the data graph.options
- loader control options, or null.
java.io.IOException
public static void saveDataGraph(commonj.sdo.DataGraph dataGraph, java.io.OutputStream outputStream, java.util.Map options) throws java.io.IOException
dataGraph
- the data graph to save.outputStream
- the outputStream for the data graph.options
- serializer control options, or null.
java.io.IOException
public static void registerDataGraphTypes(commonj.sdo.DataGraph dataGraph, java.util.List types)
type
(s) to be serialized along with
the data object
(s) in the graph. For example, the list of types returned from
TypeHelper.define(commonj.sdo.DataObject)
can be registered with this method, allowing deserialization of
instances of a dynamically defined model.
dataGraph
- the DataGraph in which to register the specified type(s).types
- a list containing the type(s) to be registered (TBD or null to automatically register all
types used by the objects in the DataGraph).public static commonj.sdo.helper.TypeHelper createTypeHelper()
public static commonj.sdo.helper.DataFactory createDataFactory(commonj.sdo.helper.TypeHelper scope)
scope
- the TypeHelper to use for locating types.
public static commonj.sdo.helper.XMLHelper createXMLHelper(commonj.sdo.helper.TypeHelper scope)
scope
- the TypeHelper to use for locating types.
public static commonj.sdo.helper.XSDHelper createXSDHelper(commonj.sdo.helper.TypeHelper scope)
scope
- the TypeHelper to use for locating and populating types.
public static XMLStreamHelper createXMLStreamHelper(commonj.sdo.helper.TypeHelper scope)
scope
- the TypeHelper to use for locating types.
public static commonj.sdo.helper.CopyHelper createCrossScopeCopyHelper(commonj.sdo.helper.TypeHelper targetScope)
targetScope
- the TypeHelper containing the Types to use to create the copy objects.
public static java.util.List getTypes(commonj.sdo.helper.TypeHelper scope, java.lang.String uri)
scope
- the TypeHelper to use for locating types.uri.
- Uri of the Types
public static commonj.sdo.Type createType(commonj.sdo.helper.TypeHelper scope, java.lang.String uri, java.lang.String name, boolean isDataType)
public static void addBaseType(commonj.sdo.Type type, commonj.sdo.Type baseType)
public static void addAliasName(commonj.sdo.Type type, java.lang.String aliasName)
public static void setOpen(commonj.sdo.Type type, boolean isOpen)
public static void setSequenced(commonj.sdo.Type type, boolean isSequenced)
public static void setAbstract(commonj.sdo.Type type, boolean isAbstract)
public static void setJavaClassName(commonj.sdo.Type type, java.lang.String javaClassName)
public static commonj.sdo.Property createProperty(commonj.sdo.Type containingType, java.lang.String name, commonj.sdo.Type propertyType)
public static void addAliasName(commonj.sdo.Property property, java.lang.String aliasName)
public static void setMany(commonj.sdo.Property property, boolean isMany)
public static void setContainment(commonj.sdo.Property property, boolean isContainment)
public static void setDefault(commonj.sdo.Property property, java.lang.String defaultValue)
public static void setReadOnly(commonj.sdo.Property property, boolean isReadOnly)
public static void setOpposite(commonj.sdo.Property property, commonj.sdo.Property opposite)
public static void registerStaticTypes(java.lang.Class factoryClass)
factoryClass
- the generated factory class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |