com.ca.commons.datamodel.concurrent
Class ConcurrentModelClass

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

public final class ConcurrentModelClass
extends Object
implements DataModelClass


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.
 ConcurrentModelClass clone()
           
 String getAbsoluteName()
           
 DataModelItem getContainer()
           
 Collection<com.ca.commons.datamodel.concurrent.ConcurrentProperty> getDataModelProperties()
          Lists the data model properties associated with this data model class.
 com.ca.commons.datamodel.concurrent.ConcurrentProperty getDataModelProperty(String name)
           
 String getDocumentation()
           
 List<String> getExtends()
          Returns the names of classes that this class extends (if any).
 List<ConcurrentModelClass> getExtendsClasses()
          Returns the classes that this class extends (if any).
 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, 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 ConcurrentModelClass clone()

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

getDataModelProperties

@NotNull
public Collection<com.ca.commons.datamodel.concurrent.ConcurrentProperty> getDataModelProperties()
Description copied from interface: DataModelClass
Lists the data model properties associated with this data model class.

Specified by:
getDataModelProperties in interface DataModelClass
Returns:
An unmodifiable collection of DataModelProperty objects.

getDataModelProperty

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

getExtends

@NotNull
public List<String> getExtends()
Description copied from interface: DataModelClass
Returns the names of classes that this class extends (if any).

Specified by:
getExtends in interface DataModelClass
Returns:
A collection of String objects. Never null.

getExtendsClasses

@NotNull
public List<ConcurrentModelClass> getExtendsClasses()
Description copied from interface: DataModelClass
Returns the classes that this class extends (if any).

Specified by:
getExtendsClasses in interface DataModelClass
Returns:
A collection of String objects. Never null.

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

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