Class ParameterWrapper


  • @Beta
    @PublicAPI
    public class ParameterWrapper
    extends Object
    Wraps a parameter which can be set or get on an object.

    Usually parameters of Builder objects are wrapped

    Please note that support of all types and validation is not complete yet.

    Please note that this class is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

    • Method Detail

      • getAPIFieldName

        public String getAPIFieldName()
        API field name.
        Returns:
        The API field name of the represented parameter
      • getShortName

        public String getShortName()
        Short name.
        Returns:
        Short name of the represented parameter - from its Description annotation
      • getName

        public String getName()
        Name.
        Returns:
        Name of the represented parameter - from its Description annotation
      • getDetailedDescription

        public String getDetailedDescription()
        Detailed description.
        Returns:
        Detailed description of the represented parameter - from its Description annotation
      • getMinDouble

        public com.google.common.base.Optional<Double> getMinDouble()
        Smallest possible floating point value for floating point fields.
        Returns:
        smallest possible floating point value if specified
      • getMaxDouble

        public com.google.common.base.Optional<Double> getMaxDouble()
        Largest possible floating point value for floating point fields.
        Returns:
        largest possible floating point value if specified
      • getMinLong

        public com.google.common.base.Optional<Long> getMinLong()
        Smallest possible fixed point value for fixed point fields.
        Returns:
        smallest possible fixed point value if specified
      • getMaxLong

        public com.google.common.base.Optional<Long> getMaxLong()
        Largest possible fixed point value for fixed point fields.
        Returns:
        largest possible fixed point value if specified
      • getCurrentValue

        public Object getCurrentValue()
        Current value.
        Returns:
        The current value of the represented parameter
      • getCurrentValueOn

        public Object getCurrentValueOn​(Object o)
        Current value on a different object.
        Parameters:
        o - Object to use to get the value
        Returns:
        The current value of the represented parameter on a different objetc
      • setValue

        public void setValue​(Object o)
        Set value.
        Parameters:
        o - Value to set. Type must match represented parameter type. Note that setting null is not allowed.
      • getLongValue

        public long getLongValue()
        Value of an long field.
        Returns:
        The value of the long field.
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • setLongValue

        public void setLongValue​(long i)
        Set long value of a long field.
        Parameters:
        i - Value to be set
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • getIntValue

        public int getIntValue()
        Value of an int field.
        Returns:
        The value of the int field.
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • setIntValue

        public void setIntValue​(int i)
        Set int value of a int field.
        Parameters:
        i - Value to be set
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • getDoubleValue

        public double getDoubleValue()
        Value of a double field.
        Returns:
        The value of the represented double field.
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • setDoubleValue

        public void setDoubleValue​(double d)
        Set value of a double field.
        Parameters:
        d - Value to be set
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • getStringValue

        public String getStringValue()
        Value of a String field.
        Returns:
        The value of a String field.
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • setStringValue

        public void setStringValue​(String s)
        Set String value of a String field.
        Parameters:
        s - Value to be set
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • getBooleanValue

        public boolean getBooleanValue()
        Value of a boolean field.
        Returns:
        The value of a boolean field.
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • setBooleanValue

        public void setBooleanValue​(boolean b)
        Set value of a boolean field.
        Parameters:
        b - Value to be set
        Throws:
        UnsupportedOperationException - when the associated parameters type is different
      • getParameterClass

        public Class<?> getParameterClass()
        Parameter field class.
        Returns:
        Parameter field class
      • getEnumParameterClass

        public Class<? extends Enum> getEnumParameterClass()
        Return enum class for enum field.
        Returns:
        Enum class for enum field
      • getEnumValue

        public Enum getEnumValue()
        Value of an enum field.
        Returns:
        The current value
        Throws:
        UnsupportedOperationException - when the associated parameters type is different