Class Any

java.lang.Object
overit.geocall.model.Any
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Any

public class Any extends Object implements Serializable
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

    Fields
    Modifier and Type
    Field
    Description
    protected Conventions
     
    static final Any
    Converter based on the Conventions.CODING object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of Any based on the specified Conventions
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    as(Class<T> t, Object... oo)
    Tries to make a generic Class convertion 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.
    Tries to convert the first parameter to Euro; if the conversion fails, it tries to convert to Euro the second parameter, and so on.
    asDate(Object... oo)
    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.
    asFloat(Object... oo)
    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.
    asList(Object... oo)
    Tries to convert the first parameter to List; if the conversion fails, it tries to convert to List the second parameter, and so on.
    Tries to convert the first parameter to LocalDate; if the conversion fails, it tries to convert to LocalDate the second parameter, and so on.
    Tries to convert the first parameter to LocalDateTime; if the conversion fails, it tries to convert to LocalDateTime the second parameter, and so on.
    Tries to convert the first parameter to LocalTime; if the conversion fails, it tries to convert to LocalTime the second parameter, and so on.
    asLong(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.
    asMap(Object... oo)
    Tries to convert the first parameter to Map; if the conversion fails, it tries to convert to Map the second parameter, and so on.
    Tries to convert the first parameter to OffsetDateTime; if the conversion fails, it tries to convert to OffsetDateTime the second parameter, and so on.
    Tries to convert the first parameter to OffsetTime; if the conversion fails, it tries to convert to OffsetTime the second parameter, and so on.
    asSet(Object... oo)
    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.
    Tries to convert the first parameter to ZonedDateTime; if the conversion fails, it tries to convert to ZonedDateTime the second parameter, and so on.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Any

      public Any(Conventions c)
      Creates an instance of Any based on the specified Conventions
      Parameters:
      c - The Conventions used to make the data types transformations
  • Method Details

    • asInteger

      public Integer asInteger(Object... oo)
      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

      public Long asLong(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. 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

      public Double asDouble(Object... oo)
      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

      public Float asFloat(Object... oo)
      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

      public Boolean asBoolean(Object... oo)
      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

      public String asString(Object... oo)
      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 the Conventions object 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

      public Euro 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. For the conversions, it uses the cultural conventions defined in the Conventions object 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

      public Date asDate(Object... oo)
      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 the Conventions object 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

      public LocalDateTime asLocalDateTime(Object... oo)
      Tries to convert the first parameter to LocalDateTime; if the conversion fails, it tries to convert to LocalDateTime the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert
      Returns:
      The LocalDateTime that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
    • asLocalDate

      public LocalDate asLocalDate(Object... oo)
      Tries to convert the first parameter to LocalDate; if the conversion fails, it tries to convert to LocalDate the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert
      Returns:
      The LocalDate that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
    • asLocalTime

      public LocalTime asLocalTime(Object... oo)
      Tries to convert the first parameter to LocalTime; if the conversion fails, it tries to convert to LocalTime the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert
      Returns:
      The LocalTime that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail
    • asSet

      public Set asSet(Object... oo)
      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

      public List asList(Object... oo)
      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

      public Map asMap(Object... oo)
      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

      public <T> T as(Class<T> t, Object... oo)
      Tries to make a generic Class convertion 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 - The Class object to be checked
      oo - 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

      public ZonedDateTime asZonedDateTime(Object... oo)
      Tries to convert the first parameter to ZonedDateTime; if the conversion fails, it tries to convert to ZonedDateTime the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert.
      Returns:
      The ZonedDateTime that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail.
    • asOffsetDateTime

      public OffsetDateTime asOffsetDateTime(Object... oo)
      Tries to convert the first parameter to OffsetDateTime; if the conversion fails, it tries to convert to OffsetDateTime the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert.
      Returns:
      The OffsetDateTime that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail.
    • asOffsetTime

      public OffsetTime asOffsetTime(Object... oo)
      Tries to convert the first parameter to OffsetTime; if the conversion fails, it tries to convert to OffsetTime the second parameter, and so on. If no conversion succeeds, it returns null.
      Parameters:
      oo - The objects to convert
      Returns:
      The OffsetTime that corresponds to the first of the parameters for which the conversion was successful, or null if all conversions fail