public enum HelperInvocations extends Enum<HelperInvocations> implements Invokable
An enumeration class defining some simple helper Invokable
implementations.
There are cases where an Invokable
is needed, but no concrete value
object is available. For instance, when creating a bean an initializer script
may be supported, but it is optional. This enumeration class provides helper
objects which can be used for optional invocations rather than doing
null checks all the time. So this is an application of the null
object pattern.
The constants defined by this class are dummy implementations which do not
actually perform any meaningful action. They differ in the values returned by
their implementation of the invoke()
method. Because these
implementations are state-less, they can be defined as enumeration constants
and shared between all interested parties.
Enum Constant and Description |
---|
IDENTITY_INVOCATION
An implementation of
Invokable which realizes an identity
invocation. |
NULL_INVOCATION
A specialized
Invokable implementation which always returns
null in its invoke() implementation. |
Modifier and Type | Method and Description |
---|---|
List<Dependency> |
getParameterDependencies()
Returns the dependencies for this invocation.
|
static HelperInvocations |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static HelperInvocations[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final HelperInvocations NULL_INVOCATION
Invokable
implementation which always returns
null in its invoke()
implementation.public static final HelperInvocations IDENTITY_INVOCATION
Invokable
which realizes an identity
invocation. It always returns the object passed in as invocation target
without any further modifications.public static HelperInvocations[] values()
for (HelperInvocations c : HelperInvocations.values()) System.out.println(c);
public static HelperInvocations valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic List<Dependency> getParameterDependencies()
getParameterDependencies
in interface Invokable
Invokable
Copyright © 2016 The JGUIraffe Team. All rights reserved.