Class Define


public class Define extends AnchorBean<Define>
A bean where the definitions of many different NamedBeans can be specified.

These definitions are indexed by string identifiers.

Author:
Owen Feehan
  • Constructor Details

    • Define

      public Define()
  • Method Details

    • add

      public void add(NamedBean<?> bean) throws DefineAddException
      Adds a named-bean to our definitions, using the {#link GroupingRoot} annotation to determine a group where definitions are stored.

      Any added-bean must of a type that contains the GroupingRoot annotation in its class hierarchy.

      Parameters:
      bean - a named-bean to add.
      Throws:
      DefineAddException - if a {#link GroupingRoot} cannot be found in the class-hierarchy.
    • addAll

      public void addAll(Define source)
      Adds all the named-beans from source to the current map.

      This is a shallow copy.

      Parameters:
      source - where to copy from.
    • addAll

      public <T extends AnchorBean<?>> void addAll(List<NamedBean<T>> list) throws DefineAddException
      Adds all the named-beans from source to the current map.

      This is a shallow copy.

      Type Parameters:
      T - type of bean to add.
      Parameters:
      list - where to copy from.
      Throws:
      DefineAddException - if a {#link GroupingRoot} cannot be found in the class-hierarchy.
    • listFor

      public <T extends AnchorBean<?>> List<NamedBean<T>> listFor(Class<?> groupingRoot)
      Retrieves the list of elements associated with a grouping-root.
      Type Parameters:
      T - type of elements in the list to retrieve. This should correspond to groupingRoot or a subclass.
      Parameters:
      groupingRoot - a class corresponding to a grouping-root (family-type) that may exist in Define.
      Returns:
      a newly created list with all associated elements, or an empty-list if no elements are associated.
    • duplicateBean

      public Define duplicateBean()
      Description copied from class: AnchorBean
      Creates a new bean that deep-copies every property value.

      Any state that is not a BeanField is ignored.

      Overrides:
      duplicateBean in class AnchorBean<Define>
      Returns:
      the newly created bean