Class Property

java.lang.Object
org.opt4j.config.Property

public class Property extends Object
The Property contains information about a single property of a PropertyModule.
  • Field Details

    • module

      protected final com.google.inject.Module module
    • name

      protected final String name
    • type

      protected final Class<?> type
    • getter

      protected final Method getter
    • setter

      protected final Method setter
    • info

      protected String info
    • order

      protected int order
    • requirements

      protected final Collection<Requirement> requirements
    • annotations

      protected final Map<Class<? extends Annotation>,Annotation> annotations
  • Constructor Details

    • Property

      public Property(com.google.inject.Module module, String name, Class<?> type, Method getter, Method setter, Iterable<Annotation> annotations)
      Constructs a Property .
      Parameters:
      module - the module
      name - the name
      type - the type
      getter - the getter method
      setter - the setter method
      annotations - the annotations
  • Method Details

    • getInfo

      public String getInfo()
      Returns the info.
      Returns:
      the info
      See Also:
    • setInfo

      public void setInfo(String info)
      Sets the info.
      Parameters:
      info - the info to set
      See Also:
    • getOrder

      public int getOrder()
      Returns the order.
      Returns:
      the order
      See Also:
    • setOrder

      public void setOrder(int order)
      Sets the order.
      Parameters:
      order - the order to set
      See Also:
    • getName

      public String getName()
      Returns the name.
      Returns:
      the name
    • getType

      public Class<?> getType()
      Returns the type.
      Returns:
      the type
    • getGetter

      public Method getGetter()
      Returns the getter method.
      Returns:
      the getter
    • getSetter

      public Method getSetter()
      Returns the setter method.
      Returns:
      the setter
    • addRequirement

      public void addRequirement(Requirement requirement)
      Adds a Requirement.
      Parameters:
      requirement - the requirement to add
    • isActive

      public boolean isActive()
      Returns true if the property is active.
      Returns:
      true if the property is active
    • getRequirements

      public Collection<Requirement> getRequirements()
      Returns the requirements.
      Returns:
      the requirements
    • getValue

      public Object getValue()
      Returns the value of the property.
      Returns:
      the value of the property
      See Also:
    • setValue

      public void setValue(Object value) throws InvocationTargetException
      Sets the value of the property.
      Parameters:
      value - the value to set
      Throws:
      InvocationTargetException - thrown if the value cannot be assigned
      See Also:
    • setValue

      public void setValue(String value) throws InvocationTargetException
      Sets the value of the property. The property has first to be converted to a the corresponding type.
      Parameters:
      value - the value to set
      Throws:
      InvocationTargetException - thrown if the value cannot be assigned
    • isNumber

      public boolean isNumber()
      Returns true if the property represents a number.
      Returns:
      true if the property represents a number
    • setValueObject

      protected void setValueObject(Object value) throws InvocationTargetException
      Sets the value of the property.
      Parameters:
      value - the value to set
      Throws:
      InvocationTargetException - thrown if the value cannot be assigned
    • getAnnotations

      public Collection<Annotation> getAnnotations()
      Returns the annotations of this property.
      Returns:
      the annotations
    • getAnnotation

      public <A extends Annotation> A getAnnotation(Class<? extends A> clazz)
      Returns the annotation of the specified class or null if not existent.
      Type Parameters:
      A - the annotation type
      Parameters:
      clazz - the specific annotation class
      Returns:
      the annotation