public abstract class Mod extends Object implements Encodable, DispatchTarget, Cloneable
encode()
method called for by the Encodable
interface.Modifier | Constructor and Description |
---|---|
protected |
Mod()
Base constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
attachTo(BasicObject object)
Attach this mod to an object.
|
Object |
clone()
Clone this object.
|
Context |
context()
Obtain the context in which the object this mod is attached to is
located, regardless of how deeply nested in containers the object might
be.
|
protected void |
ensureHolding(User who)
Guard function to guarantee that an operation being attempted by a user
is being applied to an object that that user is holding.
|
protected void |
ensureInContext(User who)
Guard function to guarantee that an operation being attempted by a user
on an object that is contained by the user's context.
|
protected void |
ensureReachable(User who)
Guard function to guarantee that an operation being attempted by a user
is being applied to an object that that user is allowed to reach (either
because it is in the context or because the user is holding it).
|
protected void |
ensureSameContext(User who)
Guard function to guarantee that an operation being attempted by a user
on an object is taking place in the same context as the object.
|
protected void |
ensureSameUser(User who)
Guard function to guarantee that an operation being attempted by a user
is being applied to that same user.
|
protected BasicObject |
holder()
Obtain the user or context holding the object to which this mod is
attached, regardless of how deeply nested in containers it might be.
|
boolean |
isEphemeral()
Test if this mod is ephemeral.
|
void |
markAsChanged()
Mark the object to which this mod is attached as having been changed and
thus in need of checkpointing.
|
void |
markAsEphemeral()
Mark this mod as being ephemeral.
|
BasicObject |
object()
Obtain the object to which this mod is attached.
|
public void attachTo(BasicObject object)
Only one mod of any given class may be attached to any given object.
Application code will not normally need to call this method, since it is called automatically when an object is loaded from persistent storage. However, certain specialized applications that synthesize objects directly will need to use this to attach the mods they have constructed to the objects they have constructed.
object
- The object to which this mod is to be attached.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
protected void ensureReachable(User who) throws MessageHandlerException
MessageHandlerException
exception.who
- The user who is attempting the operation.MessageHandlerException
- if the test fails.protected void ensureHolding(User who) throws MessageHandlerException
MessageHandlerException
exception.who
- The user who is attempting the operation.MessageHandlerException
- if the test fails.protected void ensureSameUser(User who) throws MessageHandlerException
MessageHandlerException
.who
- The user who is attempting the operation.MessageHandlerException
- if the test fails.protected void ensureSameContext(User who) throws MessageHandlerException
MessageHandlerException
.who
- The user who is attempting the operation.MessageHandlerException
- if the test fails.protected void ensureInContext(User who) throws MessageHandlerException
MessageHandlerException
.who
- The user who is attempting the operation.MessageHandlerException
- if the test fails.protected BasicObject holder()
public boolean isEphemeral()
markAsEphemeral()
method.public void markAsChanged()
public void markAsEphemeral()
public BasicObject object()
public Context context()
Copyright © 2017. All rights reserved.