Interface MapElementView<T>
- Type Parameters:
T- the type of element that this handles.
public interface MapElementView<T>
This class provides a means for reading map data in a data- or implementation-agnostic way.
Each of the methods take an arbitrary field type enumeration. Each implementation of this view
should be clear as to what those valid values are.
- Since:
- 2.6.0
- Author:
- Matthew Tropiano
-
Method Summary
Modifier and TypeMethodDescriptiondefault BooleangetBoolean(T source, int fieldType) Gets the corresponding value on the element as a boolean.default booleangetBoolean(T source, int fieldType, boolean def) Gets the corresponding value on the element as a boolean.default DoubleGets the corresponding value on the element as a double.default doubleGets the corresponding value on the element as a double.default FloatGets the corresponding value on the element as a float.default floatGets the corresponding value on the element as a float.default IntegergetInteger(T source, int fieldType) Gets the corresponding value on the element as an integer.default intgetInteger(T source, int fieldType, int def) Gets the corresponding value on the element as an integer.default LongGets the corresponding value on the element as a long.default longGets the corresponding value on the element as a double.default StringGets the corresponding value on the element as a String.default StringGets the corresponding value on the element as a String.Gets the corresponding value on the element.
-
Method Details
-
getValue
Gets the corresponding value on the element. If the field type is not valid for this element, this returnsnull.- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getBoolean
Gets the corresponding value on the element as a boolean. If the field type is not valid for this element, this returnsnull. Numeric values returntrueif nonzero, and String values aretrueif they are not blank.- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getBoolean
Gets the corresponding value on the element as a boolean. If the field type is not valid for this element, this returnsdef. Numeric values returntrueif nonzero, and String values aretrueif they are not blank.- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-
getInteger
Gets the corresponding value on the element as an integer. If the field type is not valid for this element, this returnsnull. Boolean values return1if true, and String values are converted to integer (ornullif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getInteger
Gets the corresponding value on the element as an integer. If the field type is not valid for this element, this returnsdef. Boolean values return1if true0if false, and String values are converted to integer (ordefif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-
getFloat
Gets the corresponding value on the element as a float. If the field type is not valid for this element, this returnsnull. Boolean values return1fif true,0fif false, and String values are converted to float (ornullif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getFloat
Gets the corresponding value on the element as a float. If the field type is not valid for this element, this returnsdef. Boolean values return1fif true,0fif false, and String values are converted to float (ordefif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-
getLong
Gets the corresponding value on the element as a long. If the field type is not valid for this element, this returnsnull. Boolean values return1Lif true,0Lif false, and String values are converted to long (ornullif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getLong
Gets the corresponding value on the element as a double. If the field type is not valid for this element, this returnsdef. Boolean values return1Lif true,0Lif false, and String values are converted to long (ordefif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-
getDouble
Gets the corresponding value on the element as a double. If the field type is not valid for this element, this returnsnull. Boolean values return1.0if true,0.0if false, and String values are converted to double (ornullif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getDouble
Gets the corresponding value on the element as a double. If the field type is not valid for this element, this returnsnull. Boolean values return1.0if true,0.0if false, and String values are converted to double (ornullif not convertible).- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-
getString
Gets the corresponding value on the element as a String. If the field type is not valid for this element, this returnsnull. If the value is not a String, it will be converted to one.- Parameters:
source- the source object.fieldType- the field type to retrieve.- Returns:
- the corresponding value or
nullif the field type is not valid.
-
getString
Gets the corresponding value on the element as a String. If the field type is not valid for this element, this returnsdef. If the value is not a String, it will be converted to one.- Parameters:
source- the source object.fieldType- the field type to retrieve.def- the default value to return if the field type is not valid.- Returns:
- the corresponding value or
defif the field type is not valid.
-