Package overit.geocall.model
Class Any
java.lang.Object
overit.geocall.model.Any
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Any
Object that allows the weak convertions between object types.
It is possible to instantiate an Any object starting from a
Conventions to obtain an object
that makes type convertions for the data types that depends on the specific cultural conventions used
in the application- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Conventionsstatic final AnyConverter based on theConventions.CODINGobject -
Constructor Summary
ConstructorsConstructorDescriptionAny(Conventions c) Creates an instance of Any based on the specifiedConventions -
Method Summary
Modifier and TypeMethodDescription<T> TTries to make a genericClassconvertion of the first parameter; if the conversion fails, it tries to convert the second parameter, and so on.Tries to convert the first parameter to Boolean; if the conversion fails, it tries to convert to Boolean the second parameter, and so on.asCurrency(Object... oo) Tries to convert the first parameter to Euro; if the conversion fails, it tries to convert to Euro the second parameter, and so on.Tries to convert the first parameter to Date; if the conversion fails, it tries to convert to Date the second parameter, and so on.Tries to convert the first parameter to Double; if the conversion fails, it tries to convert to Double the second parameter, and so on.Tries to convert the first parameter to Float; if the conversion fails, it tries to convert to Float the second parameter, and so on.Tries to convert the first parameter to Integer; if the conversion fails, it tries to convert to Integer the second parameter, and so on.Tries to convert the first parameter to List; if the conversion fails, it tries to convert to List the second parameter, and so on.asLocalDate(Object... oo) asLocalDateTime(Object... oo) Tries to convert the first parameter toLocalDateTime; if the conversion fails, it tries to convert toLocalDateTimethe second parameter, and so on.asLocalTime(Object... oo) Tries to convert the first parameter to Long; if the conversion fails, it tries to convert to Long the second parameter, and so on.Tries to convert the first parameter to Map; if the conversion fails, it tries to convert to Map the second parameter, and so on.asOffsetDateTime(Object... oo) Tries to convert the first parameter toOffsetDateTime; if the conversion fails, it tries to convert toOffsetDateTimethe second parameter, and so on.asOffsetTime(Object... oo) Tries to convert the first parameter toOffsetTime; if the conversion fails, it tries to convert toOffsetTimethe second parameter, and so on.Tries to convert the first parameter to Set; if the conversion fails, it tries to convert to Set the second parameter, and so on.Tries to convert the first parameter to String; if the conversion fails, it tries to convert to String the second parameter, and so on.asZonedDateTime(Object... oo) Tries to convert the first parameter toZonedDateTime; if the conversion fails, it tries to convert toZonedDateTimethe second parameter, and so on.
-
Field Details
-
CODING
Converter based on theConventions.CODINGobject -
_conventions
-
-
Constructor Details
-
Any
Creates an instance of Any based on the specifiedConventions- Parameters:
c- The Conventions used to make the data types transformations
-
-
Method Details
-
asInteger
Tries to convert the first parameter to Integer; if the conversion fails, it tries to convert to Integer the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Integer that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asLong
Tries to convert the first parameter to Long; if the conversion fails, it tries to convert to Long the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Long that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asDouble
Tries to convert the first parameter to Double; if the conversion fails, it tries to convert to Double the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Double that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asFloat
Tries to convert the first parameter to Float; if the conversion fails, it tries to convert to Float the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Float that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asBoolean
Tries to convert the first parameter to Boolean; if the conversion fails, it tries to convert to Boolean the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Boolean that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asString
Tries to convert the first parameter to String; if the conversion fails, it tries to convert to String the second parameter, and so on. For the conversions, it uses the cultural conventions defined in theConventionsobject of the instance. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The String that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asCurrency
Tries to convert the first parameter to Euro; if the conversion fails, it tries to convert to Euro the second parameter, and so on. For the conversions, it uses the cultural conventions defined in theConventionsobject of the instance. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Euro that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asDate
Tries to convert the first parameter to Date; if the conversion fails, it tries to convert to Date the second parameter, and so on. For the conversions, it uses the cultural conventions defined in theConventionsobject of the instance. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Date that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asLocalDateTime
Tries to convert the first parameter toLocalDateTime; if the conversion fails, it tries to convert toLocalDateTimethe second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The
LocalDateTimethat corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asLocalDate
Tries to convert the first parameter toLocalDate; if the conversion fails, it tries to convert toLocalDatethe second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The
LocalDatethat corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asLocalTime
Tries to convert the first parameter toLocalTime; if the conversion fails, it tries to convert toLocalTimethe second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The
LocalTimethat corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asSet
Tries to convert the first parameter to Set; if the conversion fails, it tries to convert to Set the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Set that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asList
Tries to convert the first parameter to List; if the conversion fails, it tries to convert to List the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The List that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asMap
Tries to convert the first parameter to Map; if the conversion fails, it tries to convert to Map the second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The Map that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
as
Tries to make a genericClassconvertion of the first parameter; if the conversion fails, it tries to convert the second parameter, and so on.- Type Parameters:
T- Generic types- Parameters:
t- TheClassobject to be checkedoo- The objects to convert- Returns:
- The converted object that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-
asZonedDateTime
Tries to convert the first parameter toZonedDateTime; if the conversion fails, it tries to convert toZonedDateTimethe second parameter, and so on. If no conversion succeeds, it returnsnull.- Parameters:
oo- The objects to convert.- Returns:
- The
ZonedDateTimethat corresponds to the first of the parameters for which the conversion was successful, ornullif all conversions fail.
-
asOffsetDateTime
Tries to convert the first parameter toOffsetDateTime; if the conversion fails, it tries to convert toOffsetDateTimethe second parameter, and so on. If no conversion succeeds, it returnsnull.- Parameters:
oo- The objects to convert.- Returns:
- The
OffsetDateTimethat corresponds to the first of the parameters for which the conversion was successful, ornullif all conversions fail.
-
asOffsetTime
Tries to convert the first parameter toOffsetTime; if the conversion fails, it tries to convert toOffsetTimethe second parameter, and so on. If no conversion succeeds, it returns null.- Parameters:
oo- The objects to convert- Returns:
- The
OffsetTimethat corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
-