com.ca.commons.datamodel.concurrent
Class ConcurrentNamespace

java.lang.Object
  extended by com.ca.commons.datamodel.concurrent.ConcurrentNamespace
All Implemented Interfaces:
DataModelItem, DataModelNamespace, HasMetadata, Cloneable

public final class ConcurrentNamespace
extends Object
implements DataModelNamespace


Field Summary
 
Fields inherited from interface com.ca.commons.datamodel.DataModelItem
NAME_DELIMITER
 
Method Summary
 com.ca.commons.datamodel.concurrent.ConcurrentProperty addMetaDataProperty(String name)
          Create an empty metadata property on this item with provided name and type, if one does not already exist.
 ConcurrentNamespace clone()
           
 String getAbsoluteName()
           
 DataModelItem getContainer()
           
 ConcurrentModelClass getDataModelClass(String name)
           
 Collection<ConcurrentModelClass> getDataModelClasses()
           
 String getDocumentation()
           
 com.ca.commons.datamodel.concurrent.ConcurrentEnumDef getEnumDef(String name)
           
 Collection<com.ca.commons.datamodel.concurrent.ConcurrentEnumDef> getEnumDefs()
           
 ConcurrentModelClass getMetadataClass(String name)
           
 Collection<ConcurrentModelClass> getMetadataClasses()
          Don't expect clients to call these methods as metadata classes (and the inheritance heirachy for normal classes) are merely a transient mechanism used to attach all the properties and metadata settings to the right classes.
 Collection<com.ca.commons.datamodel.concurrent.ConcurrentProperty> getMetaDataProperties()
          Returns collection of DataModelPropertys describing metadata.
 com.ca.commons.datamodel.concurrent.ConcurrentProperty getMetaDataProperty(String name)
           
 boolean getMetaDataPropertyBool(String boolPropName, boolean def)
          Helper function which returns boolean value for contained property with name boolPropName or def if no such property exists.
 String getMetaDataPropertyStr(String strPropName, String def)
          Helper function which returns String value for contained property with name strPropName or def if no such property exists.
 DataModel getModel()
           
 String getName()
           
 boolean isMetadata()
          Classes and properties can represent datamodel or metamodel.
 Object mdObject(String mdName, Object defaultValue)
          Returns the untyped value of a metadata item.
 String mdString(String mdName, String defaultValue)
          Returns the string value of a metadata item.
 com.ca.commons.functional.Option<DataModelValue> mdValue(String mdName)
           
<T> T
mdValue(String mdName, T defaultValue)
          Tries to retrieve the value of the metadata item as a particular type.
<T> T
mdValue(String mdName, T defaultValue, Class<? extends T> type)
          Tries to retrieve the value of a metadata item as a particular type.
 void setDocumentation(String doc)
           
 void setMetaDataPropertyBool(String boolPropName, boolean b)
          Helper function to ensure that the named metadata property is set to the provided value on this item.
 void setMetaDataPropertyStr(String strPropName, String s)
          Helper function to ensure that the named metadata property is set to the provided value on this item.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ca.commons.datamodel.DataModelItem
addMetaDataProperty, getAbsoluteName, getContainer, getDocumentation, getMetaDataProperties, getMetaDataProperty, getMetaDataPropertyBool, getMetaDataPropertyStr, getModel, getName, isMetadata, setDocumentation, setMetaDataPropertyBool, setMetaDataPropertyStr
 
Methods inherited from interface com.ca.commons.datamodel.HasMetadata
mdObject, mdString, mdValue, mdValue, mdValue
 

Method Detail

clone

@NotNull
public ConcurrentNamespace clone()

getEnumDefs

@NotNull
public Collection<com.ca.commons.datamodel.concurrent.ConcurrentEnumDef> getEnumDefs()
Specified by:
getEnumDefs in interface DataModelNamespace

getEnumDef

public com.ca.commons.datamodel.concurrent.ConcurrentEnumDef getEnumDef(@NotNull
                                                                        String name)
                                                                 throws DataModelException
Specified by:
getEnumDef in interface DataModelNamespace
Throws:
DataModelException

getDataModelClasses

@NotNull
public Collection<ConcurrentModelClass> getDataModelClasses()
Specified by:
getDataModelClasses in interface DataModelNamespace
Returns:
List of DataModelClass for normal classes.

getDataModelClass

@Nullable
public ConcurrentModelClass getDataModelClass(@NotNull
                                                       String name)
                                       throws DataModelException
Specified by:
getDataModelClass in interface DataModelNamespace
Throws:
DataModelException

getMetadataClasses

@NotNull
public Collection<ConcurrentModelClass> getMetadataClasses()
Description copied from interface: DataModelNamespace
Don't expect clients to call these methods as metadata classes (and the inheritance heirachy for normal classes) are merely a transient mechanism used to attach all the properties and metadata settings to the right classes. Hence use the expedient measure of representing metadata classes as normal classes (even though they, are their properties, will never have metadata lists themselves).

Specified by:
getMetadataClasses in interface DataModelNamespace
Returns:
List of DataModelClass for metadata classes.

getMetadataClass

@Nullable
public ConcurrentModelClass getMetadataClass(String name)
                                      throws DataModelException
Specified by:
getMetadataClass in interface DataModelNamespace
Throws:
DataModelException

getModel

@NotNull
public DataModel getModel()
Specified by:
getModel in interface DataModelItem

getAbsoluteName

@NotNull
public final String getAbsoluteName()
Specified by:
getAbsoluteName in interface DataModelItem

getName

@NotNull
public final String getName()
Specified by:
getName in interface DataModelItem

isMetadata

public boolean isMetadata()
Description copied from interface: DataModelItem
Classes and properties can represent datamodel or metamodel.

Specified by:
isMetadata in interface DataModelItem

getMetaDataProperties

@NotNull
public Collection<com.ca.commons.datamodel.concurrent.ConcurrentProperty> getMetaDataProperties()
Description copied from interface: DataModelItem
Returns collection of DataModelPropertys describing metadata.

Specified by:
getMetaDataProperties in interface DataModelItem

getMetaDataProperty

@Nullable
public com.ca.commons.datamodel.concurrent.ConcurrentProperty getMetaDataProperty(String name)
                                                                           throws DataModelException
Specified by:
getMetaDataProperty in interface DataModelItem
Throws:
DataModelException

getContainer

@Nullable
public final DataModelItem getContainer()
                                 throws DataModelException
Specified by:
getContainer in interface DataModelItem
Throws:
DataModelException

getDocumentation

@NotNull
public final String getDocumentation()
Specified by:
getDocumentation in interface DataModelItem

setDocumentation

public void setDocumentation(@NotNull
                             String doc)
Specified by:
setDocumentation in interface DataModelItem

addMetaDataProperty

@NotNull
public com.ca.commons.datamodel.concurrent.ConcurrentProperty addMetaDataProperty(@NotNull
                                                                                          String name)
Description copied from interface: DataModelItem
Create an empty metadata property on this item with provided name and type, if one does not already exist.

Specified by:
addMetaDataProperty in interface DataModelItem

setMetaDataPropertyBool

public void setMetaDataPropertyBool(@NotNull
                                    String boolPropName,
                                    boolean b)
Description copied from interface: DataModelItem
Helper function to ensure that the named metadata property is set to the provided value on this item.

Specified by:
setMetaDataPropertyBool in interface DataModelItem

mdObject

@Nullable
public Object mdObject(@NotNull
                                String mdName,
                                @Nullable
                                Object defaultValue)
Description copied from interface: HasMetadata
Returns the untyped value of a metadata item. This is a shortcut for mdValue(mdName, defaultValue, Object.class).

Specified by:
mdObject in interface HasMetadata
Parameters:
mdName - The name of the metadata item.
defaultValue - A default value to return if the named item is not found.
Returns:
The metadata item's value, or the default value if no matching item was found.
See Also:
HasMetadata.mdValue(String, Object, Class)

mdString

@Nullable
public String mdString(@NotNull
                                String mdName,
                                @Nullable
                                String defaultValue)
Description copied from interface: HasMetadata
Returns the string value of a metadata item. This is a shortcut for mdValue(mdName, defaultValue, String.class).

Specified by:
mdString in interface HasMetadata
Parameters:
mdName - The name of the metadata item.
defaultValue - A default value to return if the named item is not found, or its value is not a string.
Returns:
The metadata item's value, or the default value if no matching item was found.
See Also:
HasMetadata.mdValue(String, Object, Class)

mdValue

@NotNull
public <T> T mdValue(@NotNull
                             String mdName,
                             @NotNull
                             T defaultValue)
Description copied from interface: HasMetadata
Tries to retrieve the value of the metadata item as a particular type. This method requires a non-null default, and uses the class of the default value to determine the type of value expected by the caller. It is roughly equivalent to mdValue(mdName, defaultValue, defaultValue.getClass()).

Specified by:
mdValue in interface HasMetadata
Parameters:
mdName - The name of the metadata item to retrieve.
defaultValue - The default value to return if the metadata item cannot be retrieved. Also indicates the type of value expected by the caller.
Returns:
The metadata value, or the default value if no matching item was found, or the value had a different type.
See Also:
HasMetadata.mdValue(String, Object, Class)

mdValue

@Nullable
public <T> T mdValue(@NotNull
                              String mdName,
                              @Nullable
                              T defaultValue,
                              @NotNull
                              Class<? extends T> type)
Description copied from interface: HasMetadata
Tries to retrieve the value of a metadata item as a particular type. If the metadata item does not exist, or is not of a type compatible with the expected type, then the default value (possibly null) is returned.

Specified by:
mdValue in interface HasMetadata
Parameters:
mdName - The name of the metadata item to retrieve.
defaultValue - The default value to return if the metadata item cannot be retrieved.
type - A class object indicating the type of the value that is expected.
Returns:
The metadata value, or the default value if no matching item was found, or the value had a different type. If the returned value is not null, type.isInstance(returnedValue) is always true.

mdValue

@NotNull
public com.ca.commons.functional.Option<DataModelValue> mdValue(@NotNull
                                                                        String mdName)
Specified by:
mdValue in interface HasMetadata

toString

public String toString()
Overrides:
toString in class Object

getMetaDataPropertyBool

public final boolean getMetaDataPropertyBool(String boolPropName,
                                             boolean def)
Description copied from interface: DataModelItem
Helper function which returns boolean value for contained property with name boolPropName or def if no such property exists.

Specified by:
getMetaDataPropertyBool in interface DataModelItem

getMetaDataPropertyStr

public String getMetaDataPropertyStr(String strPropName,
                                     String def)
Description copied from interface: DataModelItem
Helper function which returns String value for contained property with name strPropName or def if no such property exists.

Specified by:
getMetaDataPropertyStr in interface DataModelItem

setMetaDataPropertyStr

public void setMetaDataPropertyStr(String strPropName,
                                   String s)
Description copied from interface: DataModelItem
Helper function to ensure that the named metadata property is set to the provided value on this item.

Specified by:
setMetaDataPropertyStr in interface DataModelItem


Created 2011-07-14 13:27 EST