@Beta @PublicAPI public class ParameterWrapper extends 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.
Modifier and Type | Class and Description |
---|---|
static class |
ParameterWrapper.ParameterType
Wrapped parameter types.
|
Modifier and Type | Method and Description |
---|---|
String |
getAPIFieldName()
API field name.
|
boolean |
getBooleanValue()
Value of a boolean field.
|
Object |
getCurrentValue()
Current value.
|
Object |
getCurrentValueOn(Object o)
Current value on a different object.
|
String |
getDetailedDescription()
Detailed description.
|
double |
getDoubleValue()
Value of a double field.
|
Class<? extends Enum> |
getEnumParameterClass()
Return enum class for enum field.
|
Enum |
getEnumValue()
Value of an enum field.
|
int |
getIntValue()
Value of an int field.
|
long |
getLongValue()
Value of an long field.
|
Optional<Double> |
getMaxDouble()
Largest possible floating point value for floating point fields.
|
Optional<Long> |
getMaxLong()
Largest possible fixed point value for fixed point fields.
|
Optional<Double> |
getMinDouble()
Smallest possible floating point value for floating point fields.
|
Optional<Long> |
getMinLong()
Smallest possible fixed point value for fixed point fields.
|
String |
getName()
Name.
|
Class<?> |
getParameterClass()
Parameter field class.
|
String |
getShortName()
Short name.
|
String |
getStringValue()
Value of a String field.
|
ParameterWrapper.ParameterType |
getType()
Type.
|
void |
parseParameterValue(String value)
Parse parameter value from a String.
|
void |
setBooleanValue(boolean b)
Set value of a boolean field.
|
void |
setDoubleValue(double d)
Set value of a double field.
|
void |
setIntValue(int i)
Set int value of a int field.
|
void |
setLongValue(long i)
Set long value of a long field.
|
void |
setStringValue(String s)
Set String value of a String field.
|
void |
setValue(Object o)
Set value.
|
String |
toStringRepresentation()
Create String representation of the represented value.
|
public String getAPIFieldName()
public String getShortName()
public String getName()
public String getDetailedDescription()
public Optional<Double> getMinDouble()
public Optional<Double> getMaxDouble()
public Optional<Long> getMinLong()
public Optional<Long> getMaxLong()
public Object getCurrentValue()
public Object getCurrentValueOn(Object o)
o
- Object to use to get the valuepublic void setValue(Object o)
o
- Value to set. Type must match represented parameter type. Note that setting null
is not
allowed.public ParameterWrapper.ParameterType getType()
public String toStringRepresentation()
Note that this method uses Enum.name()
instead of its Object.toString()
since later
can be overridden preventing further safe parse.
Note that ParameterWrapper.ParameterType.OTHER
type parameters are currently not supported.
parseParameterValue(java.lang.String)
UnsupportedOperationException
- when represented parameter type is ParameterWrapper.ParameterType.OTHER
public void parseParameterValue(String value)
value
- String value. Note that null
values are not allowed.IllegalArgumentException
- when parse failedUnsupportedOperationException
- when represented parameter type is ParameterWrapper.ParameterType.OTHER
public long getLongValue()
UnsupportedOperationException
- when the associated parameters type is differentpublic void setLongValue(long i)
i
- Value to be setUnsupportedOperationException
- when the associated parameters type is differentpublic int getIntValue()
UnsupportedOperationException
- when the associated parameters type is differentpublic void setIntValue(int i)
i
- Value to be setUnsupportedOperationException
- when the associated parameters type is differentpublic double getDoubleValue()
UnsupportedOperationException
- when the associated parameters type is differentpublic void setDoubleValue(double d)
d
- Value to be setUnsupportedOperationException
- when the associated parameters type is differentpublic String getStringValue()
UnsupportedOperationException
- when the associated parameters type is differentpublic void setStringValue(String s)
s
- Value to be setUnsupportedOperationException
- when the associated parameters type is differentpublic boolean getBooleanValue()
UnsupportedOperationException
- when the associated parameters type is differentpublic void setBooleanValue(boolean b)
b
- Value to be setUnsupportedOperationException
- when the associated parameters type is differentpublic Class<?> getParameterClass()
public Class<? extends Enum> getEnumParameterClass()
public Enum getEnumValue()
UnsupportedOperationException
- when the associated parameters type is different