T
- the type of the object that changedpublic abstract class Change<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
Change(T jobj)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
apply()
Apply this change to the transaction associated with the current thread.
|
void |
apply(JObject jobj)
Apply this change to the specified object.
|
void |
apply(JTransaction jtx)
Apply this change to the object associated with this instance in the given transaction.
|
abstract void |
apply(JTransaction jtx,
JObject jobj)
Apply this change to the given object in the given transaction.
|
boolean |
equals(Object obj) |
JObject |
getJObject()
Get the Java model object containing the field that changed.
|
T |
getObject()
Get the Java model object containing the field that changed.
|
int |
hashCode() |
abstract <R> R |
visit(ChangeSwitch<R> target)
Apply visitor pattern.
|
protected Change(T jobj)
jobj
- Java model object that changedIllegalArgumentException
- if jobj
is nullpublic T getObject()
Although not declared as such to allow flexibility in Java model types, the returned object
will always be a JObject
instance.
public JObject getJObject()
This is a convenience method, equivalent to:
(JObject)getObject()
JObject
public abstract <R> R visit(ChangeSwitch<R> target)
target
corresponding to this instance's type.R
- visitor return typetarget
- visitor pattern targettarget
public abstract void apply(JTransaction jtx, JObject jobj)
jobj
- the target object to which to apply this changejtx
- the transaction in which to apply this changeNullPointerException
- if jtx
or jobj
is nullDeletedObjectException
- if jobj
does not exist in jtx
UnknownFieldException
- if jobj
has a schema version that
does not contain the affected field, or in which the affected field has a different typeRuntimeException
- if there is some other incompatibility between this change and the target object,
for example, setting a list element at an index that is out of boundsStaleTransactionException
- if jtx
is no longer usablepublic void apply(JTransaction jtx)
This is a convenience method, equivalent to:
apply(jtx, this.getJObject());
jtx
- transaction in which to apply this changeIllegalArgumentException
- if jtx
is nullpublic void apply()
This is a convenience method, equivalent to:
apply(JTransaction.getCurrent())
IllegalStateException
- if there is no JTransaction
associated with the current threadpublic void apply(JObject jobj)
This is a convenience method, equivalent to:
apply(obj.getTransaction(), jobj);
jobj
- object to which to apply this changeIllegalStateException
- if there is no JTransaction
associated with jobj
IllegalArgumentException
- if jobj
is nullCopyright © 2022. All rights reserved.