public class Parameter extends Object implements Serializable
Note that while its reference cannot be changed once set (the attribute is final
), the
parameter descriptor itself is possibly mutable (it can be set as immutable, but it is not a
definitive property and it's not the case by default). Also note that it is possible for the
parameter descriptor to be null
or empty (that is, not associated with any field).
However, using parameters in such a state is strongly discouraged since it can potentially lead
to errors if higher-level methods do not handle these cases properly.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAME_SEPARATOR
Default name separator for the
toString() and getName() methods. |
static String |
DEFAULT_VALUE_SEPARATOR
Default value separator for the
toString() methods. |
Constructor and Description |
---|
Parameter(ParameterDescriptor parameterDescriptor,
double parameterValue)
Creates a new instance using the provided parameter descriptor and value.
|
Parameter(String parameterName,
double parameterValue)
Creates a new instance using the provided name and value.
|
Modifier and Type | Method and Description |
---|---|
Parameter |
copy()
Performs a shallow copy of this parameter (the references to the field descriptors and the
mapped values are preserved).
|
boolean |
equals(Object object)
Indicates whether some other object is "equal to" this one.
|
ParameterDescriptor |
getDescriptor()
Gets the parameter descriptor.
|
String |
getName()
Gets the parameter name, which is a concatenation of field values currently associated with
the parameter descriptor (printed in reverse order by default).
|
String |
getName(boolean reverseOrder)
Gets the parameter name, which is a concatenation of field values currently associated with
the parameter descriptor.
|
String |
getName(String separator)
Gets the parameter name, which is a concatenation of field values currently associated with
the parameter descriptor (printed in reverse order by default).
|
String |
getName(String separator,
boolean reverseOrder)
Gets the parameter name, which is a concatenation of field values currently associated with
the parameter descriptor.
|
double |
getValue()
Gets the parameter value.
|
int |
hashCode() |
void |
setValue(double parameterValue)
Sets the parameter value.
|
String |
toString()
Gets a string representation of this parameter, which includes the name of this class, the
name of the parameter and the parameter value.
|
String |
toString(boolean reverseOrder)
Gets a string representation of this parameter, which includes the name of this class, the
name of the parameter and the parameter value.
|
String |
toString(String nameSeparator,
String valueSeparator,
boolean printClassName,
boolean reverseOrder)
Gets a string representation of this parameter, which includes the name of this class (if
requested), the name of the parameter and the parameter value.
|
public static final String DEFAULT_VALUE_SEPARATOR
toString()
methods.public static final String DEFAULT_NAME_SEPARATOR
toString()
and getName()
methods.public Parameter(String parameterName, double parameterValue)
parameterName
- the parameter nameparameterValue
- the parameter valuepublic Parameter(ParameterDescriptor parameterDescriptor, double parameterValue)
parameterDescriptor
- the parameter descriptorparameterValue
- the parameter valuepublic ParameterDescriptor getDescriptor()
public String getName()
public String getName(boolean reverseOrder)
reverseOrder
- whether or not the field values should be printed in reverse ordernull
if the parameter descriptor associated with this
parameter is null
public String getName(String separator)
separator
- the string used as separator between two field valuesnull
if the parameter descriptor associated with this
parameter is null
public String getName(String separator, boolean reverseOrder)
separator
- the string used as separator between two field valuesreverseOrder
- whether or not the field values should be printed in reverse ordernull
if the parameter descriptor associated with this
parameter is null
public double getValue()
public void setValue(double parameterValue)
parameterValue
- the new parameter valuepublic String toString()
public String toString(boolean reverseOrder)
reverseOrder
- whether or not the associated field values should be printed in reverse orderpublic String toString(String nameSeparator, String valueSeparator, boolean printClassName, boolean reverseOrder)
nameSeparator
- the string to be used as separator when retrieving the name of the parametervalueSeparator
- the string to be used as separator between the name of the parameter and its valueprintClassName
- whether or not the name of this class should be printedreverseOrder
- whether or not the associated field values should be printed in reverse ordergetName(String, boolean)
public Parameter copy()
public boolean equals(Object object)
This methods simply redirects to the Object.equals(Object) method, which considers that two objects are equals if and only if they are the same instance. This default behavior is preserved on purpose for historical reasons, as other classes sometimes use the Parameter class as key in their internal maps and rely on the fact that two separate Parameter instances can never be equal.
Copyright © 2023 CNES. All rights reserved.