Class ParmKeyType

java.lang.Object
org.bzdev.obnaming.ParmKeyType

public class ParmKeyType extends Object
Specify the type of a compound key. This class is used to represent the type of a compound key by providing the types of its components. When a key is represented as a String, the subkeys are separated by a period, with each component having a type constraint. Otherwise the keys are represented as an array of objects. The string representation is handled automatically by the set, add,unset, and remove methods provided by named-object factories. These methods convert the string to an appropriate array.

A ParmKeyType specifies the types of the objects in the array representation. A ParmKeyType can also be declared to be addable (this flag is specified in a constructor). When a ParmKeyType is addable, one of a factory's add methods can be used with this key, as can the factory's remove methods, but the set and unset methods cannot be used.

  • Constructor Details

    • ParmKeyType

      public ParmKeyType(Class<?>[] classArray)
      Constructor.
      Parameters:
      classArray - an array of classes, each naming the type of a component of a key
    • ParmKeyType

      public ParmKeyType(Class<?>[] classArray, boolean addable)
      Constructor with an addable flag.
      Parameters:
      classArray - an array of classes, each naming the type of a component of a key
      addable - true if the key can be added; false otherwise.
  • Method Details

    • getComponents

      public Class<?>[] getComponents()
      Get an array of the ParmKeyType components
      Returns:
      an array of components listed in order
    • isAddable

      public boolean isAddable()
      Determine of a ParmKeyType is addable. A ParmKeyType is addable if one of a factory's add methods can be used. Addable entries can be used in some cases to add a default entry to a keyed table or to represent a set of objects.
      Returns:
      true if this ParmKeyType is addable; false if it is not addable.
    • description

      public String description()
      Describe a ParmKeyType. If there is only one component, that component's fully qualified class name is returned. Otherwise, the class name of each component is delimited by angle brackets ("<" and ">"), with each component separated by a period.
      Returns:
      a description listing the components of a ParmKeyType