|
exedio cope | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.exedio.cope.Item
public abstract class Item
This is the super class for all classes, that want to store their data persistently with COPE.
Serialization of instances of Item is guaranteed to be light-weight - there are no non-static, non-transient object reference fields in this class or its superclasses.
| Field Summary | |
|---|---|
static ItemField.DeletePolicy |
CASCADE
|
static ItemField.DeletePolicy |
FORBID
|
static ItemField.DeletePolicy |
NULLIFY
|
| Constructor Summary | |
|---|---|
protected |
Item(ReactivationConstructorDummy reactivationDummy,
int pk)
Reactivation constructor. |
protected |
Item(ReactivationConstructorDummy reactivationDummy,
int pk,
Type<? extends Item> typeWithoutJavaClass)
|
protected |
Item(SetValue... setValues)
|
|
Item(SetValue[] setValues,
Type<? extends Item> typeWithoutJavaClass)
|
| Method Summary | ||
|---|---|---|
Item |
activeCopeItem()
Returns the active item object representing the same item as this item object. |
|
void |
deleteCopeItem()
|
|
boolean |
equals(Object o)
Returns true, if o represents the same item as this item. |
|
boolean |
existsCopeItem()
Returns, whether the item does exist. |
|
|
get(Function<E> function)
|
|
String |
getCopeID()
Returns a string unique for this item in all other items of the model. |
|
Type<? extends Item> |
getCopeType()
Returns the type of this item. |
|
int |
hashCode()
Returns a hash code, that is consistent with equals(Object). |
|
boolean |
isActiveCopeItem()
Returns, whether this item is active. |
|
static
|
newEnumAttribute(Class<E> valueClass)
Deprecated. Renamed to newEnumField(Class). |
|
static
|
newEnumField(Class<E> valueClass)
|
|
static
|
newItemAttribute(Class<E> valueClass)
Deprecated. Renamed to newItemField(Class). |
|
static
|
newItemAttribute(Class<E> valueClass,
ItemField.DeletePolicy policy)
Deprecated. Renamed to newItemField(Class, com.exedio.cope.ItemField.DeletePolicy). |
|
static
|
newItemField(Class<E> valueClass)
|
|
static
|
newItemField(Class<E> valueClass,
ItemField.DeletePolicy policy)
|
|
protected static
|
newType(Class<C> javaClass)
|
|
protected void |
postCreate()
Is called after every item creation. |
|
|
set(FunctionField<E> field,
E value)
|
|
void |
set(SetValue... setValues)
|
|
String |
toString()
Returns getCopeID() as a default implementation
for all persistent classes. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ItemField.DeletePolicy FORBID
public static final ItemField.DeletePolicy NULLIFY
public static final ItemField.DeletePolicy CASCADE
| Constructor Detail |
|---|
protected Item(SetValue... setValues)
MandatoryViolationException - if value is null and field
is mandatory.
ClassCastException - if value is not compatible to field.
public Item(SetValue[] setValues,
Type<? extends Item> typeWithoutJavaClass)
protected Item(ReactivationConstructorDummy reactivationDummy,
int pk)
protected Item(ReactivationConstructorDummy reactivationDummy,
int pk,
Type<? extends Item> typeWithoutJavaClass)
| Method Detail |
|---|
public final String getCopeID()
Model.getItem(String)public final Type<? extends Item> getCopeType()
public final boolean equals(Object o)
(o != null) && (o instanceof Item) && getCopeID().equals(((Item)o).getCopeID())Does not activate this item, if it's not already active.
equals in class Objectpublic final int hashCode()
equals(Object).
Note, that this is not neccessarily equivalent to getCopeID().hashCode().
Does not activate this item, if it's not already active.
hashCode in class Objectpublic String toString()
getCopeID() as a default implementation
for all persistent classes.
toString in class Objectpublic final boolean isActiveCopeItem()
public final Item activeCopeItem()
If and only if a.equals(b) then a.activeCopeItem() == b.activeCopeItem().
So it does for items, what String.intern() does for strings.
Does activate this item, if it's not already active.
Is guaranteed to be very cheap, if this item object is already active, which means
this method returns this.
Never returns null.
protected void postCreate()
public final <E> E get(Function<E> function)
public final <E> void set(FunctionField<E> field,
E value)
throws UniqueViolationException,
MandatoryViolationException,
StringLengthViolationException,
FinalViolationException,
ClassCastException
MandatoryViolationException - if value is null and field
is mandatory.
FinalViolationException - if field is final.
ClassCastException - if value is not compatible to field.
UniqueViolationException
StringLengthViolationException
public final void set(SetValue... setValues)
throws UniqueViolationException,
MandatoryViolationException,
StringLengthViolationException,
FinalViolationException,
ClassCastException
MandatoryViolationException - if value is null and field
is mandatory.
FinalViolationException - if field is final.
ClassCastException - if value is not compatible to field.
UniqueViolationException
StringLengthViolationException
public final void deleteCopeItem()
throws IntegrityViolationException
IntegrityViolationExceptionpublic final boolean existsCopeItem()
deleteCopeItem().
Model.rollback().
protected static final <C extends Item> Type<C> newType(Class<C> javaClass)
public static final <E extends Enum<E>> EnumField<E> newEnumField(Class<E> valueClass)
public static final <E extends Item> ItemField<E> newItemField(Class<E> valueClass)
public static final <E extends Item> ItemField<E> newItemField(Class<E> valueClass,
ItemField.DeletePolicy policy)
@Deprecated public static final <E extends Enum<E>> EnumField<E> newEnumAttribute(Class<E> valueClass)
newEnumField(Class).
@Deprecated public static final <E extends Item> ItemField<E> newItemAttribute(Class<E> valueClass)
newItemField(Class).
@Deprecated
public static final <E extends Item> ItemField<E> newItemAttribute(Class<E> valueClass,
ItemField.DeletePolicy policy)
newItemField(Class, com.exedio.cope.ItemField.DeletePolicy).
|
Cope with Object Persistence |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||