Class ObjectListParameter<C>

  • Type Parameters:
    C - Class type
    All Implemented Interfaces:
    Parameter<java.util.List<java.lang.Class<? extends C>>>

    public class ObjectListParameter<C>
    extends ClassListParameter<C>
    Parameter that represents a list of objects (in contrast to a class list parameter, they will be instanced at most once.)
    Since:
    0.3
    Author:
    Erich Schubert
    • Field Detail

      • instances

        private java.util.List<C> instances
        Cache for the generated instances.
    • Constructor Detail

      • ObjectListParameter

        public ObjectListParameter​(OptionID optionID,
                                   java.lang.Class<?> restrictionClass)
        Constructor for non-optional.
        Parameters:
        optionID - Option ID
        restrictionClass - Restriction class
    • Method Detail

      • parseValue

        protected java.util.List<java.lang.Class<? extends C>> parseValue​(java.lang.Object obj)
                                                                   throws ParameterException
        Description copied from class: AbstractParameter
        Parse a given value into the destination type.
        Overrides:
        parseValue in class ClassListParameter<C>
        Parameters:
        obj - Object to parse (may be a string representation!)
        Returns:
        Parsed object
        Throws:
        ParameterException - when the object cannot be parsed.
      • instantiateClasses

        public java.util.List<C> instantiateClasses​(Parameterization config)
        Description copied from class: ClassListParameter
        Returns a list of new instances for the value (i.e., the class name) of this class list parameter. The instances have the type of the restriction class of this class list parameter.

        If the Class for the class names is not found, the instantiation is tried using the package of the restriction class as package of the class name.

        Overrides:
        instantiateClasses in class ClassListParameter<C>
        Parameters:
        config - Parameterization to use (if Parameterizable))
        Returns:
        a list of new instances for the value of this class list parameter