Class GetterPipe

java.lang.Object
overit.geocall.util.GetterPipe

public class GetterPipe extends Object
This utility class allows the creation of a structure for the search of values, with a specific logic of fields to search for, and possibly fall back to a default value if the search fails.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GetterPipe(Iterator<Getter> i, String[] fields, boolean deepFirst, int maxDeep)
    Constructs a GetterPipe with the specific search parameters and behaviours
    GetterPipe(Iterator<Getter> i, String field, int maxDeep)
    Constructs a GetterPipe with the specific search parameters and behaviours.
    GetterPipe(Getter[] gg, String[] fields, boolean deepFirst)
    Constructs a GetterPipe that makes the search over the Array of Getter objects.
    GetterPipe(Getter g, String[] fields)
    Constructs a GetterPipe that makes an amplitude search of the key fields on a single Getter object
  • Method Summary

    Modifier and Type
    Method
    Description
    get(Object def)
    Searches for a generic Object and returns it, or returns the default one if the search fails
    boolean
    getboolean(boolean def)
    Searches for a boolean value and returns it, or returns the default one if the search fails
    Searches for a Boolean value and returns it, or returns the default one if the search fails
    Searches for a Date value and returns it, or returns the default one if the search fails
    double
    getdouble(double def)
    Searches for a double value and returns it, or returns the default one if the search fails
    Searches for a Double value and returns it, or returns the default one if the search fails
    float
    getfloat(float def)
    Searches for a float value and returns it, or returns the default one if the search fails
    Searches for a Float value and returns it, or returns the default one if the search fails
    int
    getint(int def)
    Searches for an int value and returns it, or returns the default one if the search fails
    Searches for an Integer value and returns it, or returns the default one if the search fails
    long
    getlong(long def)
    Searches for a long value and returns it, or returns the default one if the search fails
    Searches for a Long value and returns it, or returns the default one if the search fails
    Searches for a string value and returns it, or returns the default one if the search fails

    Methods inherited from class java.lang.Object

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

    • GetterPipe

      public GetterPipe(Getter g, String[] fields)
      Constructs a GetterPipe that makes an amplitude search of the key fields on a single Getter object
      Parameters:
      g - The Getter object on which perform the search
      fields - An Array of strings, each of which used as key for the search
    • GetterPipe

      public GetterPipe(Getter[] gg, String[] fields, boolean deepFirst)
      Constructs a GetterPipe that makes the search over the Array of Getter objects. The search behaviour depends on the value of the deepFirst attribute
      Parameters:
      gg - The Arrays of Getter objects on wich perform the search
      fields - An Array of strings, each of which used as key for the search
      deepFirst - true for a deep search on the Getter elements, and subsequently in amplitude with respect to the Array elements, false to obtain the opposite search configuration
    • GetterPipe

      public GetterPipe(Iterator<Getter> i, String field, int maxDeep)
      Constructs a GetterPipe with the specific search parameters and behaviours. The search will be a deep search of the key in the Iterator elements.
      Parameters:
      i - An elements Iterator on which execute the search
      field - A string used as key for the search
      maxDeep - An integer indicating the maximum depth of the research on the elements of the iterator; If set to zero indicates search with infinite depth i.e. up to the last element of the iterator
    • GetterPipe

      public GetterPipe(Iterator<Getter> i, String[] fields, boolean deepFirst, int maxDeep)
      Constructs a GetterPipe with the specific search parameters and behaviours
      Parameters:
      i - An elements Iterator on which execute the search
      fields - An Array of strings, each of which used as key for the search
      deepFirst - true for a deep search on the Iterator elements, and subsequently in amplitude with respect to the Array elements, false to obtain the opposite search configuration
      maxDeep - An integer indicating the maximum depth of the research on the elements of the iterator; If set to zero indicates search with infinite depth i.e. up to the last element of the iterator
  • Method Details

    • getString

      public String getString(String def)
      Searches for a string value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The string, if found, or the default one
    • getint

      public int getint(int def)
      Searches for an int value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The int value, if found, or the default one
    • getInteger

      public Integer getInteger(Integer def)
      Searches for an Integer value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The Integer value, if found, or the default one
    • getlong

      public long getlong(long def)
      Searches for a long value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The long value, if found, or the default one
    • getLong

      public Long getLong(Long def)
      Searches for a Long value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The Long value, if found, or the default one
    • getfloat

      public float getfloat(float def)
      Searches for a float value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The float value, if found, or the default one
    • getFloat

      public Float getFloat(Float def)
      Searches for a Float value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The Float value, if found, or the default one
    • getdouble

      public double getdouble(double def)
      Searches for a double value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The double value, if found, or the default one
    • getDouble

      public Double getDouble(Double def)
      Searches for a Double value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The Double value, if found, or the default one
    • getboolean

      public boolean getboolean(boolean def)
      Searches for a boolean value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The boolean value, if found, or the default one
    • getBoolean

      public Boolean getBoolean(Boolean def)
      Searches for a Boolean value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      Returns:
      The Boolean value, if found, or the default one
    • getDate

      public Date getDate(Date def, SimpleDateFormat sdf)
      Searches for a Date value and returns it, or returns the default one if the search fails
      Parameters:
      def - The default value, returned if the search fails
      sdf - The SimpleDateFormat that defines the format of the date to extract.
      Returns:
      The Date value, if found, with the format specified in the SimpleDateFormat, or the default one
    • get

      public Object get(Object def)
      Searches for a generic Object and returns it, or returns the default one if the search fails
      Parameters:
      def - The default object, returned if the search fails
      Returns:
      The object, if found, or the default one