Enum HelperInvocations

  • All Implemented Interfaces:
    Serializable, Comparable<HelperInvocations>, Invokable

    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.

    Since:
    1.1
    Version:
    $Id: HelperInvocations.java 208 2012-02-11 20:57:33Z oheger $
    Author:
    Oliver Heger
    • Enum Constant Detail

      • NULL_INVOCATION

        public static final HelperInvocations NULL_INVOCATION
        A specialized Invokable implementation which always returns null in its invoke() implementation.
      • IDENTITY_INVOCATION

        public static final HelperInvocations IDENTITY_INVOCATION
        An implementation of Invokable which realizes an identity invocation. It always returns the object passed in as invocation target without any further modifications.
    • Method Detail

      • values

        public static HelperInvocations[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HelperInvocations c : HelperInvocations.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HelperInvocations valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getParameterDependencies

        public List<Dependency> getParameterDependencies()
        Returns the dependencies for this invocation. This implementation always returns an empty list.
        Specified by:
        getParameterDependencies in interface Invokable
        Returns:
        the dependencies of this Invokable