com.ail.core
Class Type

java.lang.Object
  extended by com.ail.core.Type
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractCommand, Address, Address, AddressBook, ADR, Allowable, AssessmentLine, AssessmentSheet, Asset, Attribute, Claim, ClaimSection, CommandArgImp, CommandScript, Component, ConfigurationSummary, ConfigureUploadForm, Contract, Coverage, CurrencyAmount, DateOfBirth, DiaryEntry, DocumentDefinition, Excess, History, ItemData, MoneyProvision, Party, Party, PaymentMethod, PaymentSchedule, Percent, PersistenceMapping, Policy, PolicyDocumentation, ProductDetails, Query, QueryResults, Rate, Recovery, Reference, RenderContext, Section, Service, TypeWithHashtable, TypeWithMap, TypeWithSet, ValidatorFailureDetail, ValidatorResult, Version, VersionEffectiveDate, Wording, XMLMapping

public class Type
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Type is the base of all 'type model' classes that are part of the domain model. All model classes must either extend this class, or another that itself extends this class.

Version:
$Revision: 1.22 $
See Also:
Serialized Form

Field Summary
 org.apache.commons.jxpath.JXPathContext jXPathContext
           
static long NOT_PERSISTED
           
 
Constructor Summary
Type()
           
 
Method Summary
 void addAttribute(Attribute attribute)
          Add an instance of Attribute to the list associated with this object.
 java.lang.Object clone()
          Clone this object.
 void deleteLock()
           
 void deleteSerialVersion()
           
 org.apache.commons.jxpath.JXPathContext fetchJXPathContext()
           
 java.util.List<Attribute> getAttribute()
          Get the collection of instances of Attribute associated with this object.
 Attribute getAttribute(int i)
          Fetch a spacific Attribute from the collection by index number.
 int getAttributeCount()
          Get a count of the number of Attribute instances associated with this object
 java.lang.String getForeignSystemId()
          The foreign system id is provided in order to make mapping to/from external system somewhat easier.
 boolean getLock()
           
 long getSerialVersion()
           
 long getSystemId()
           
 boolean hasLock()
           
 boolean hasSerialVersion()
           
 boolean hasSystemId()
           
 boolean isPersisted()
          Return true if this object has been persisted.
 void markAsNotPersisted()
          Disassociate this object with it's persisted counterpart.
 void mergeWithDataFrom(Type donor, Core core)
          Merge data from a specified type into this.
 void removeAttribute(Attribute attribute)
          Remove the specified instance of Attribute from the list.
 void removeAttribute(int i)
          Remove the element specified from the list.
 void setAttribute(java.util.List<Attribute> attribute)
          Set the collection of instances of Attribute associated with this object.
 void setForeignSystemId(java.lang.String foreignSystemId)
           
 void setLock(boolean lock)
           
 void setSerialVersion(long serialVersion)
           
 void setSystemId(long systemId)
           
 java.lang.Object xpathGet(java.lang.String xpath)
          Execute the given xpath expression on this and return the single result.
<T> T
xpathGet(java.lang.String xpath, java.lang.Class<T> clazz)
          Evaluate the given xpath expression on this and return the result as an instance of the class clazz.
 java.util.Iterator xpathIterate(java.lang.String xpath)
          Execute the given xpath expression on this.
 void xpathSet(java.lang.String xpath, java.lang.Object obj)
          Set the value of a property within this identified by an xpath expression to a the value obj.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_PERSISTED

public static final long NOT_PERSISTED
See Also:
Constant Field Values

jXPathContext

public transient org.apache.commons.jxpath.JXPathContext jXPathContext
Constructor Detail

Type

public Type()
Method Detail

deleteLock

public void deleteLock()

hasLock

public boolean hasLock()

getLock

public boolean getLock()

setLock

public void setLock(boolean lock)

deleteSerialVersion

public void deleteSerialVersion()

hasSerialVersion

public boolean hasSerialVersion()

getSerialVersion

public long getSerialVersion()

setSerialVersion

public void setSerialVersion(long serialVersion)

hasSystemId

public boolean hasSystemId()

getSystemId

public long getSystemId()

setSystemId

public void setSystemId(long systemId)

isPersisted

public boolean isPersisted()
Return true if this object has been persisted.

Returns:
true if persisted, false otherwise.

markAsNotPersisted

public void markAsNotPersisted()
Disassociate this object with it's persisted counterpart.


fetchJXPathContext

public org.apache.commons.jxpath.JXPathContext fetchJXPathContext()

xpathGet

public java.lang.Object xpathGet(java.lang.String xpath)
Execute the given xpath expression on this and return the single result.

Parameters:
xpath - Expression to evaluate
Returns:
Result of evaluation.
Throws:
TypeXPathException - If evaluation of the expression fails.

xpathIterate

public java.util.Iterator xpathIterate(java.lang.String xpath)
Execute the given xpath expression on this. The expectation is that the xpath expression evaluates to more than one node. This method returns the matching nodes as an iteration.

Parameters:
xpath - Expression to evaluate
Returns:
Result of evaluation.
Throws:
TypeXPathException - If evaluation of the expression fails.

xpathGet

public <T> T xpathGet(java.lang.String xpath,
                      java.lang.Class<T> clazz)
Evaluate the given xpath expression on this and return the result as an instance of the class clazz.

Parameters:
xpath - Expression to evaluate
clazz - Class to return an instance of
Returns:
Result.

xpathSet

public void xpathSet(java.lang.String xpath,
                     java.lang.Object obj)
Set the value of a property within this identified by an xpath expression to a the value obj.

Parameters:
xpath - Expression identifying the property to set.
obj - value to set the property to.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone this object. This clone method is used by all Type subclasses to handle deep cloning. For the factory to operate correctly it is essential that Types can be deep cloned, as it hangs onto prototyped instances by name and simply clones them when a request is made for an instance of a named type.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException - If the type cannot be deep cloned.

mergeWithDataFrom

public void mergeWithDataFrom(Type donor,
                              Core core)
Merge data from a specified type into this. This method does not demand that the donor and 'this' (the subject) have to be of the same or even compatible types; we will simply copy whatever we can based on the property names and types.

Parameters:
donor - Take values from here into this

getAttribute

public java.util.List<Attribute> getAttribute()
Get the collection of instances of Attribute associated with this object.

Returns:
attribute A collection of instances of Excess
See Also:
setAttribute(java.util.List)

setAttribute

public void setAttribute(java.util.List<Attribute> attribute)
Set the collection of instances of Attribute associated with this object.

Parameters:
attribute - A collection of instances of Excess
See Also:
getAttribute()

getAttributeCount

public int getAttributeCount()
Get a count of the number of Attribute instances associated with this object

Returns:
Number of instances

removeAttribute

public void removeAttribute(int i)
Remove the element specified from the list.

Parameters:
i - Index of element to remove

removeAttribute

public void removeAttribute(Attribute attribute)
Remove the specified instance of Attribute from the list.

Parameters:
attribute - Instance to be removed

addAttribute

public void addAttribute(Attribute attribute)
Add an instance of Attribute to the list associated with this object.

Parameters:
attribute - Instance to add to list

getAttribute

public Attribute getAttribute(int i)
Fetch a spacific Attribute from the collection by index number.

Parameters:
i - Index of element to return

getForeignSystemId

public java.lang.String getForeignSystemId()
The foreign system id is provided in order to make mapping to/from external system somewhat easier. The expectation is that information extracted from foreign systems will have IDs of some kind which those system uses to identify the data.

Returns:
The ID

setForeignSystemId

public void setForeignSystemId(java.lang.String foreignSystemId)
Parameters:
foreignSystemId -
See Also:
getForeignSystemId()