|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.om.BaseObject
public abstract class BaseObject
This class contains attributes and methods that are used by all business objects within the system.
Field Summary | |
---|---|
static int |
NEW_ID
The constant denoting an unset numeric database identifier. |
Constructor Summary | |
---|---|
BaseObject()
|
Method Summary | |
---|---|
boolean |
equals(BaseObject bo)
Compares the primary key of this instance with the key of another. |
boolean |
equals(java.lang.Object obj)
Compares this with another BaseObject instance. |
java.lang.Object |
getByName(java.lang.String field)
Retrieves a field from the object by name. |
java.lang.Object |
getByPeerName(java.lang.String name)
Retrieves a field from the object by name passed in as a String. |
java.lang.Object |
getByPosition(int pos)
Retrieves a field from the object by position as specified in a database schema for example. |
protected org.apache.commons.logging.Log |
getLog()
gets a commons-logging Log based on class name. |
ObjectKey |
getPrimaryKey()
getter for the object primaryKey. |
TableMap |
getTableMap()
Retrieves the TableMap object related to this Table data. |
int |
hashCode()
If the primary key is not null , return the hashcode of the
primary key. |
boolean |
isModified()
Returns whether the object has been modified. |
boolean |
isNew()
Returns whether the object has ever been saved. |
void |
resetModified()
Sets the modified state for the object to be false. |
abstract void |
save()
Saves the object. |
abstract void |
save(java.sql.Connection con)
Stores the object in the database. |
abstract void |
save(java.lang.String dbName)
Stores the object in the database. |
boolean |
setByName(java.lang.String name,
java.lang.Object value)
Set a field in the object by field (Java) name. |
boolean |
setByPeerName(java.lang.String name,
java.lang.Object value)
Set field values by Peer Field Name |
boolean |
setByPosition(int position,
java.lang.Object value)
Set field values by it's position (zero based) in the XML schema. |
void |
setModified(boolean m)
Sets the modified state for the object. |
void |
setNew(boolean b)
Setter for the isNew attribute. |
void |
setPrimaryKey(ObjectKey primaryKey)
Sets the PrimaryKey for the object as an Object. |
void |
setPrimaryKey(SimpleKey[] primaryKey)
Sets the PrimaryKey for the object as an Object. |
void |
setPrimaryKey(java.lang.String primaryKey)
Sets the PrimaryKey for the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NEW_ID
Constructor Detail |
---|
public BaseObject()
Method Detail |
---|
public ObjectKey getPrimaryKey()
getPrimaryKey
in interface Persistent
public boolean isModified()
isModified
in interface Persistent
public boolean isNew()
isNew
in interface Persistent
public void setNew(boolean b)
setNew
in interface Persistent
b
- the state of the object.public void setPrimaryKey(java.lang.String primaryKey) throws TorqueException
setPrimaryKey
in interface Persistent
primaryKey
- The new PrimaryKey for the object.
TorqueException
- This method will not throw any exceptions
but this allows for children to override the method more easilypublic void setPrimaryKey(SimpleKey[] primaryKey) throws TorqueException
primaryKey
- The new PrimaryKey for the object.
TorqueException
- This method will not throw any exceptions
but this allows for children to override the method more easilypublic void setPrimaryKey(ObjectKey primaryKey) throws TorqueException
setPrimaryKey
in interface Persistent
primaryKey
- The new PrimaryKey for the object.
TorqueException
- This method will not throw any exceptions
but this allows for children to override the method more easilypublic void setModified(boolean m)
setModified
in interface Persistent
m
- The new modified state for the object.public void resetModified()
public java.lang.Object getByName(java.lang.String field)
field
- The name of the field to retrieve.
public boolean setByName(java.lang.String name, java.lang.Object value) throws TorqueException
name
- field namevalue
- field value
java.lang.IllegalArgumentException
- if object type of value does not match
field object type.
TorqueException
- If a problem occurs with the set[Field] method.public java.lang.Object getByPeerName(java.lang.String name)
name
- field name
public boolean setByPeerName(java.lang.String name, java.lang.Object value) throws TorqueException
name
- field namevalue
- field value
java.lang.IllegalArgumentException
- if object type of value does not match
field object type.
TorqueException
- If a problem occurs with the set[Field] method.public java.lang.Object getByPosition(int pos)
pos
- field position
public boolean setByPosition(int position, java.lang.Object value) throws TorqueException
position
- The field positionvalue
- field value
java.lang.IllegalArgumentException
- if object type of value does not match
field object type.
TorqueException
- If a problem occurs with the set[Field] method.public boolean equals(java.lang.Object obj)
BaseObject
instance. If
obj
is an instance of BaseObject
,
delegates to equals(BaseObject)
. Otherwise, returns
false
.
equals
in class java.lang.Object
obj
- The object to compare to.
public boolean equals(BaseObject bo)
bo
- The object to compare to.
public int hashCode()
null
, return the hashcode of the
primary key. Otherwise calls Object.hashCode()
.
hashCode
in class java.lang.Object
int
valueprotected org.apache.commons.logging.Log getLog()
Log
to write log to.public abstract void save() throws java.lang.Exception
Persistent
save
in interface Persistent
java.lang.Exception
- This method might throw an exceptionPersistent.save()
public abstract void save(java.lang.String dbName) throws java.lang.Exception
Persistent
save
in interface Persistent
dbName
- the name of the database
java.lang.Exception
- This method might throw an exceptionPersistent.save(String)
public abstract void save(java.sql.Connection con) throws java.lang.Exception
Persistent
save
in interface Persistent
con
- the Connection used to store the object
java.lang.Exception
- This method might throw an exceptionPersistent.save(Connection)
public TableMap getTableMap() throws TorqueException
TorqueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |