|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.errai.codegen.SnapshotMaker
public final class SnapshotMaker
Utility class for creating code-generated snapshots of certain types of live value objects. The classes and interfaces that SnapshotMaker works with have the following characteristics:
equals(Object)
, which is always ignored)
void
literalizable type
in the current code generator context
Nested Class Summary | |
---|---|
static interface |
SnapshotMaker.MethodBodyCallback
Callback interface for providing custom method bodies in snapshots. |
Method Summary | |
---|---|
static Statement |
makeSnapshotAsSubclass(Object o,
Class<?> typeToSnapshot,
Class<?> typeToExtend,
SnapshotMaker.MethodBodyCallback methodBodyCallback,
Class<?>... typesToRecurseOn)
Code-generates an object whose methods return (snapshots of) the same values as the given object. |
static Statement |
makeSnapshotAsSubclass(Object o,
MetaClass typeToSnapshot,
MetaClass typeToExtend,
SnapshotMaker.MethodBodyCallback methodBodyCallback,
MetaClass... typesToRecurseOn)
Code-generates an object whose methods return (snapshots of) the same values as the given object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Statement makeSnapshotAsSubclass(Object o, Class<?> typeToSnapshot, Class<?> typeToExtend, SnapshotMaker.MethodBodyCallback methodBodyCallback, Class<?>... typesToRecurseOn)
o
- The object to snapshot.typeToSnapshot
- The type to read the snapshot attributes from. Must be a
superclass of o or an interface implemented by o, and methods not
supplied by methodBodyCallback
must meed the requirements
laid out in the class-level SnapshotMaker documentation.typeToExtend
- The type of the snapshot to produce. Must be a subclass or
subinterface of typeToSnapshot, and the additional methods present
in typeToExtend vs. typeToSnapshot must be provided by the
MethodMaker callback, since they can't be generated from o.methodBodyCallback
- A callback that can provide method bodies, preventing the standard
snapshot behaviour for those methods. This callback is optional;
null is acceptable as "no callback."typesToRecurseOn
- The types for which the snapshot maker should be applied
recursively.
CyclicalObjectGraphException
- if any objects reachable from o
form a reference cycle.
The simplest example of this would be a method on o
that
returns o
itself. You may be able to work around such a
problem by supplying a canned representation of one of the
objects in the cycle.public static Statement makeSnapshotAsSubclass(Object o, MetaClass typeToSnapshot, MetaClass typeToExtend, SnapshotMaker.MethodBodyCallback methodBodyCallback, MetaClass... typesToRecurseOn)
o
- The object to snapshot.typeToSnapshot
- The type to read the snapshot attributes from. Must be a
superclass of o or an interface implemented by o, and methods not
supplied by methodBodyCallback
must meed the requirements
laid out in the class-level SnapshotMaker documentation.typeToExtend
- The type of the snapshot to produce. Must be a subclass or
subinterface of typeToSnapshot, and the additional methods present
in typeToExtend vs. typeToSnapshot must be provided by the
MethodMaker callback, since they can't be generated from o.methodBodyCallback
- A callback that can provide method bodies, preventing the standard
snapshot behaviour for those methods. This callback is optional;
null is acceptable as "no callback."typesToRecurseOn
- The types for which the snapshot maker should be applied
recursively.
CyclicalObjectGraphException
- if any objects reachable from o
form a reference cycle.
The simplest example of this would be a method on o
that
returns o
itself. You may be able to work around such a
problem by supplying a canned representation of one of the objects
in the cycle.
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |