|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.metadata.AttributeDescriptorBase
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor
public class ObjectReferenceDescriptor
Describes a Field containing a reference to another class. Provides handling for foreign keys etc.
Note: Be careful when use references of this class or caching instances of this class,
because instances could become invalid (see MetadataManager).
| Field Summary | |
|---|---|
static int |
CASCADE_LINK
|
static int |
CASCADE_NONE
|
static int |
CASCADE_OBJECT
|
| Fields inherited from class org.apache.ojb.broker.metadata.AttributeDescriptorBase |
|---|
m_ClassDescriptor, m_PersistentField |
| Constructor Summary | |
|---|---|
ObjectReferenceDescriptor(ClassDescriptor descriptor)
|
|
| Method Summary | |
|---|---|
void |
addAttribute(String attributeName,
String attributeValue)
Store the specified attribute and it's value. |
void |
addForeignKeyField(int newId)
add a foreign key field ID |
void |
addForeignKeyField(String newField)
add a foreign key field |
String |
getAttribute(String attributeName)
Get the value of an attribute |
String |
getAttribute(String attributeName,
String defaultValue)
Get the value of an attribute |
String[] |
getAttributeNames()
Returns an array of the names of all atributes of this descriptor. |
Map |
getAttributes()
Returns the attribute map (name, value) of this descriptor. |
String |
getCascadeAsString(int cascade)
|
boolean |
getCascadeDelete()
Deprecated. use getCascadingDelete() instead. |
protected int |
getCascadeDeleteValue(String cascade)
|
boolean |
getCascadeRetrieve()
|
boolean |
getCascadeStore()
Deprecated. use getCascadingStore() instead. |
protected int |
getCascadeStoreValue(String cascade)
|
int |
getCascadingDelete()
|
int |
getCascadingStore()
|
FieldDescriptor[] |
getForeignKeyFieldDescriptors(ClassDescriptor cld)
|
Vector |
getForeignKeyFields()
|
Object[] |
getForeignKeyValues(Object obj,
ClassDescriptor mif)
Returns an Object array of all FK field values of the specified object. |
Class |
getItemClass()
|
String |
getItemClassName()
|
Class |
getItemProxyClass()
|
boolean |
getOtmDependent()
|
int |
getProxyPrefetchingLimit()
|
boolean |
hasConstraint()
Returns true if a foreign key constraint to the referenced object is declared, else false is returned. |
boolean |
isLazy()
Gets the lazy. |
boolean |
isRefresh()
Gets the refresh. |
boolean |
isSuperReferenceDescriptor()
Returns true if this descriptor was used to
describe a reference to a super class of an object. |
void |
setCascadeDelete(boolean cascade)
Deprecated. use setCascadingDelete(int) |
void |
setCascadeRetrieve(boolean b)
|
void |
setCascadeStore(boolean cascade)
Deprecated. use setCascadingStore(int) instead. |
void |
setCascadingDelete(int cascade)
|
void |
setCascadingDelete(String value)
|
void |
setCascadingStore(int cascade)
|
void |
setCascadingStore(String value)
|
void |
setConstraint(boolean constraint)
Set a foreign key constraint flag for this reference - see hasConstraint() |
void |
setForeignKeyFields(Vector vec)
|
void |
setItemClass(Class c)
sets the item class |
void |
setLazy(boolean lazy)
Sets the lazy. |
void |
setOtmDependent(boolean b)
|
void |
setProxyPrefetchingLimit(int proxyPrefetchingLimit)
|
void |
setRefresh(boolean refresh)
Sets the refresh. |
String |
toString()
|
String |
toXML()
returns the XML marshalled version of this instance. |
| Methods inherited from class org.apache.ojb.broker.metadata.AttributeDescriptorBase |
|---|
getAttributeName, getClassDescriptor, getPersistentField, setClassDescriptor, setPersistentField, setPersistentField |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int CASCADE_NONE
public static final int CASCADE_LINK
public static final int CASCADE_OBJECT
| Constructor Detail |
|---|
public ObjectReferenceDescriptor(ClassDescriptor descriptor)
| Method Detail |
|---|
public Class getItemProxyClass()
throws PersistenceBrokerException
PersistenceBrokerExceptionpublic FieldDescriptor[] getForeignKeyFieldDescriptors(ClassDescriptor cld)
public Object[] getForeignKeyValues(Object obj,
ClassDescriptor mif)
throws PersistenceBrokerException
MetadataException - if an error occours while accessing ForeingKey values on obj
PersistenceBrokerExceptionpublic Class getItemClass()
public String getItemClassName()
public void setItemClass(Class c)
c - the items class objectpublic Vector getForeignKeyFields()
public void setForeignKeyFields(Vector vec)
public void addForeignKeyField(int newId)
public void addForeignKeyField(String newField)
public boolean isRefresh()
public void setRefresh(boolean refresh)
refresh - The refresh to setpublic boolean isLazy()
public void setLazy(boolean lazy)
lazy - The lazy to setpublic boolean getCascadeRetrieve()
public void setCascadeRetrieve(boolean b)
public int getCascadingStore()
public void setCascadingStore(int cascade)
public void setCascadingStore(String value)
public boolean getCascadeStore()
getCascadingStore() instead.
public void setCascadeStore(boolean cascade)
setCascadingStore(int) instead.
public int getCascadingDelete()
public void setCascadingDelete(int cascade)
public void setCascadingDelete(String value)
public boolean getCascadeDelete()
getCascadingDelete() instead.
public void setCascadeDelete(boolean cascade)
setCascadingDelete(int)
protected int getCascadeStoreValue(String cascade)
protected int getCascadeDeleteValue(String cascade)
public String getCascadeAsString(int cascade)
public int getProxyPrefetchingLimit()
public void setProxyPrefetchingLimit(int proxyPrefetchingLimit)
public boolean getOtmDependent()
public void setOtmDependent(boolean b)
public boolean isSuperReferenceDescriptor()
true if this descriptor was used to
describe a reference to a super class of an object.
false for this instance.public boolean hasConstraint()
public void setConstraint(boolean constraint)
hasConstraint()
constraint - If set true, signals a foreign key constraint in database.public String toString()
toString in class AttributeDescriptorBasepublic String toXML()
XmlCapable
toXML in interface XmlCapable
public void addAttribute(String attributeName,
String attributeValue)
AttributeContainer
addAttribute in interface AttributeContainerattributeName - the name of the attribute to retrieveattributeValue - the attribute's valueAttributeContainer.addAttribute(String, String)
public String getAttribute(String attributeName,
String defaultValue)
AttributeContainer
getAttribute in interface AttributeContainerattributeName - the attribute to retrievedefaultValue - the value to return if the attribute is not present
AttributeContainer.getAttribute(String, String)public String getAttribute(String attributeName)
AttributeContainer
getAttribute in interface AttributeContainerattributeName - the attribute to retrieve
AttributeContainer.getAttribute(String)public Map getAttributes()
public String[] getAttributeNames()
null)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||