Class Property


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

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,​java.lang.annotation.Annotation> annotations  
      protected java.lang.reflect.Method getter  
      protected java.lang.String info  
      protected com.google.inject.Module module  
      protected java.lang.String name  
      protected int order  
      protected java.util.Collection<Requirement> requirements  
      protected java.lang.reflect.Method setter  
      protected java.lang.Class<?> type  
    • Constructor Summary

      Constructors 
      Constructor Description
      Property​(com.google.inject.Module module, java.lang.String name, java.lang.Class<?> type, java.lang.reflect.Method getter, java.lang.reflect.Method setter, java.lang.Iterable<java.lang.annotation.Annotation> annotations)
      Constructs a Property .
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRequirement​(Requirement requirement)
      Adds a Requirement.
      <A extends java.lang.annotation.Annotation>
      A
      getAnnotation​(java.lang.Class<? extends A> clazz)
      Returns the annotation of the specified class or null if not existent.
      java.util.Collection<java.lang.annotation.Annotation> getAnnotations()
      Returns the annotations of this property.
      java.lang.reflect.Method getGetter()
      Returns the getter method.
      java.lang.String getInfo()
      Returns the info.
      java.lang.String getName()
      Returns the name.
      int getOrder()
      Returns the order.
      java.util.Collection<Requirement> getRequirements()
      Returns the requirements.
      java.lang.reflect.Method getSetter()
      Returns the setter method.
      java.lang.Class<?> getType()
      Returns the type.
      java.lang.Object getValue()
      Returns the value of the property.
      boolean isActive()
      Returns true if the property is active, i.e., all Requirements must be fulfilled.
      boolean isNumber()
      Returns true if the property represents a number.
      void setInfo​(java.lang.String info)
      Sets the info.
      void setOrder​(int order)
      Sets the order.
      void setValue​(java.lang.Object value)
      Sets the value of the property.
      void setValue​(java.lang.String value)
      Sets the value of the property.
      protected void setValueObject​(java.lang.Object value)
      Sets the value of the property.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • module

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

        protected final java.lang.String name
      • type

        protected final java.lang.Class<?> type
      • getter

        protected final java.lang.reflect.Method getter
      • setter

        protected final java.lang.reflect.Method setter
      • info

        protected java.lang.String info
      • order

        protected int order
      • requirements

        protected final java.util.Collection<Requirement> requirements
      • annotations

        protected final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,​java.lang.annotation.Annotation> annotations
    • Constructor Detail

      • Property

        public Property​(com.google.inject.Module module,
                        java.lang.String name,
                        java.lang.Class<?> type,
                        java.lang.reflect.Method getter,
                        java.lang.reflect.Method setter,
                        java.lang.Iterable<java.lang.annotation.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 Detail

      • setInfo

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

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

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

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

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

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

        public java.lang.reflect.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, i.e., all Requirements must be fulfilled.
        Returns:
        true if the property is active
      • getRequirements

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

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

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

        public void setValue​(java.lang.String value)
                      throws java.lang.reflect.InvocationTargetException
        Sets the value of the property. The property has first to be converted to the corresponding type.
        Parameters:
        value - the value to set
        Throws:
        java.lang.reflect.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​(java.lang.Object value)
                               throws java.lang.reflect.InvocationTargetException
        Sets the value of the property.
        Parameters:
        value - the value to set
        Throws:
        java.lang.reflect.InvocationTargetException - thrown if the value cannot be assigned
      • getAnnotations

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

        public <A extends java.lang.annotation.Annotation> A getAnnotation​(java.lang.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