mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-09 08:52:51 +00:00
@@ -17,6 +17,7 @@
|
||||
package com.l2jserver.model;
|
||||
|
||||
import com.l2jserver.model.id.ID;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
@@ -41,17 +42,59 @@ public interface Model<T extends ID<?>> {
|
||||
void setID(T ID) throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Each object has an desire. Desires express what the
|
||||
* {@link DatabaseService} should do with the object. The service
|
||||
* automatically keep tracks of every database object (and release them when
|
||||
* they are garbage collected).
|
||||
*
|
||||
* @return the database object desire
|
||||
*/
|
||||
ObjectDesire getObjectDesire();
|
||||
|
||||
/**
|
||||
* Each object has an desire. Desires express what the
|
||||
* {@link DatabaseService} should do with the object. The service
|
||||
* automatically keep tracks of every database object (and release them when
|
||||
* they are garbage collected).
|
||||
*
|
||||
* @param desire
|
||||
* the database object desire to set
|
||||
*/
|
||||
void setObjectDesire(ObjectDesire desire);
|
||||
|
||||
/**
|
||||
* Indicated what the object wants to do in the database. It indicates
|
||||
* whether the object should be inserted, updated or deleted from the
|
||||
* database.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ObjectDesire {
|
||||
NONE, INSERT, UPDATE, DELETE;
|
||||
/**
|
||||
* Don't do anything
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Insert a new object into database.
|
||||
* <p>
|
||||
* If the primary key is auto generated by the database a clone of this
|
||||
* object will be created.<br>
|
||||
* If the primary key is <b>not</b> auto generated by the database, an
|
||||
* database exception will occur.
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* Updates the object in the database.
|
||||
* <p>
|
||||
* If the object is not in the database nothing will happen.
|
||||
*/
|
||||
UPDATE,
|
||||
/**
|
||||
* Deletes the object from the database.
|
||||
* <p>
|
||||
* If tge object is not in the database nothing will happen.
|
||||
*/
|
||||
DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user