public class TriggerDefinition
extends java.lang.Object
Triggers are anonymous inner classes that may have data members. The initialization of those data members naturally occurs during construction. This means that only after construction can one be assured that the value of a trigger's data members is set to the expected default value. This means that every time a trigger is executed, that execution must occur on a newly constructed instance, so that the data member's default values will be correct.
This class stores the data needed to delegate the construction of a
Trigger
subclass to code that is executing that trigger. This is
performed via a lambda expression, which creates a new instance of the
trigger each time the trigger is invoked.
The complexity of the instantiation is hidden in this class. The logic
can be found in getTrigger()
.
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
externalProgram
The external program instance where the trigger was defined.
|
private boolean |
fromExternalProgram
Flag indicating the trigger definition was created in an external program.
|
private boolean |
fullTrans
Determines if this trigger should start a full transaction.
|
private static java.util.logging.Logger |
LOG
Logger (this is JVM-wide rather than being context-local).
|
private java.util.function.Supplier<Trigger> |
trigger
The supplier for this trigger's instances.
|
Constructor and Description |
---|
TriggerDefinition(java.util.function.Supplier<Trigger> trigger,
java.lang.Object outer,
boolean fullTrans)
Constructor for lambda mode.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getExternalProgram()
Get the external program instance where this trigger was defined.
|
Trigger |
getTrigger()
Construct a new instance of the trigger class that is defined by the
contained metadata.
|
boolean |
isFromExternalProgram()
Check if this trigger was created by an external program.
|
private static final java.util.logging.Logger LOG
private java.util.function.Supplier<Trigger> trigger
private java.lang.Object externalProgram
private boolean fullTrans
private final boolean fromExternalProgram
public TriggerDefinition(java.util.function.Supplier<Trigger> trigger, java.lang.Object outer, boolean fullTrans)
trigger
- The specific Trigger
instance that implements the
trigger logic.outer
- The instance of the containing class for the trigger.fullTrans
- true
if the trigger should start a full
transaction, false
if the trigger should
create a sub-transaction.public Trigger getTrigger()
null
.public java.lang.Object getExternalProgram()
public boolean isFromExternalProgram()
fromExternalProgram
flag.