Class GenericParameter

java.lang.Object
io.inverno.mod.http.base.internal.GenericParameter
All Implemented Interfaces:
Parameter
Direct Known Subclasses:
GenericCookieParameter

public class GenericParameter extends Object implements Parameter

Generic Parameter implementation.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Field Details

    • parameterConverter

      protected final ObjectConverter<String> parameterConverter
      The parameter value converter.
    • name

      protected final String name
      The parameter name.
    • value

      protected final String value
      The parameter value.
  • Constructor Details

    • GenericParameter

      public GenericParameter(String name, String value, ObjectConverter<String> parameterConverter)

      Creates a generic parameter with the specified parameter name, parameter value and parameter value converter.

      Parameters:
      name - a parameter name
      value - a parameter value
      parameterConverter - a string object converter
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Parameter

      Returns the parameter name.

      Specified by:
      getName in interface Parameter
      Returns:
      a name
    • getValue

      public String getValue()
      Description copied from interface: Parameter

      Returns the parameter raw value.

      Specified by:
      getValue in interface Parameter
      Returns:
      a raw value
    • as

      public <T> T as(Class<T> type)
      Description copied from interface: Parameter

      Converts the parameter value to the specified type.

      Specified by:
      as in interface Parameter
      Type Parameters:
      T - the target type
      Parameters:
      type - a class of type T
      Returns:
      the converted parameter value or null
    • as

      public <T> T as(Type type)
      Description copied from interface: Parameter

      Converts the parameter value to the specified type.

      Specified by:
      as in interface Parameter
      Type Parameters:
      T - the target type
      Parameters:
      type - the target type
      Returns:
      the converted parameter value or null
    • asArrayOf

      public <T> T[] asArrayOf(Class<T> type)
      Description copied from interface: Parameter

      Converts the parameter value to an array of the specified type.

      Specified by:
      asArrayOf in interface Parameter
      Type Parameters:
      T - the target component type
      Parameters:
      type - a class of type T
      Returns:
      the parameter value converted to an array of T or null
    • asArrayOf

      public <T> T[] asArrayOf(Type type)
      Description copied from interface: Parameter

      Converts the parameter value to an array of the specified type.

      Specified by:
      asArrayOf in interface Parameter
      Type Parameters:
      T - the target component type
      Parameters:
      type - the target component type
      Returns:
      the parameter value converted to an array of T or null
    • asListOf

      public <T> List<T> asListOf(Class<T> type)
      Description copied from interface: Parameter

      Converts the parameter value to a list of the specified type.

      Specified by:
      asListOf in interface Parameter
      Type Parameters:
      T - the target list argument type
      Parameters:
      type - a class of type T
      Returns:
      the parameter value converted to a list of T or null
    • asListOf

      public <T> List<T> asListOf(Type type)
      Description copied from interface: Parameter

      Converts the parameter value to a list of the specified type.

      Specified by:
      asListOf in interface Parameter
      Type Parameters:
      T - the target list argument type
      Parameters:
      type - the target list argument type
      Returns:
      the parameter value converted to a list of T or null
    • asSetOf

      public <T> Set<T> asSetOf(Class<T> type)
      Description copied from interface: Parameter

      Converts the parameter value to a set of the specified type.

      Specified by:
      asSetOf in interface Parameter
      Type Parameters:
      T - the target set argument type
      Parameters:
      type - a class of type T
      Returns:
      the parameter value converted to a set of T or null
    • asSetOf

      public <T> Set<T> asSetOf(Type type)
      Description copied from interface: Parameter

      Converts the parameter value to a set of the specified type.

      Specified by:
      asSetOf in interface Parameter
      Type Parameters:
      T - the target set argument type
      Parameters:
      type - the target set argument type
      Returns:
      the parameter value converted to a set of T or null
    • asByte

      public Byte asByte()
      Description copied from interface: Parameter

      Converts the parameter value to a byte.

      Specified by:
      asByte in interface Parameter
      Returns:
      the converted parameter value or null
    • asShort

      public Short asShort()
      Description copied from interface: Parameter

      Converts the parameter value to a short.

      Specified by:
      asShort in interface Parameter
      Returns:
      the converted parameter value or null
    • asInteger

      public Integer asInteger()
      Description copied from interface: Parameter

      Converts the parameter value to an integer.

      Specified by:
      asInteger in interface Parameter
      Returns:
      the converted parameter value or null
    • asLong

      public Long asLong()
      Description copied from interface: Parameter

      Converts the parameter value to a long.

      Specified by:
      asLong in interface Parameter
      Returns:
      the converted parameter value or null
    • asFloat

      public Float asFloat()
      Description copied from interface: Parameter

      Converts the parameter value to a float.

      Specified by:
      asFloat in interface Parameter
      Returns:
      the converted parameter value or null
    • asDouble

      public Double asDouble()
      Description copied from interface: Parameter

      Converts the parameter value to a double.

      Specified by:
      asDouble in interface Parameter
      Returns:
      the converted parameter value or null
    • asCharacter

      public Character asCharacter()
      Description copied from interface: Parameter

      Converts the parameter value to a character.

      Specified by:
      asCharacter in interface Parameter
      Returns:
      the converted parameter value or null
    • asString

      public String asString()
      Description copied from interface: Parameter

      Converts the parameter value to a string.

      Specified by:
      asString in interface Parameter
      Returns:
      the converted parameter value or null
    • asBoolean

      public Boolean asBoolean()
      Description copied from interface: Parameter

      Converts the parameter value to a boolean.

      Specified by:
      asBoolean in interface Parameter
      Returns:
      the converted parameter value or null
    • asBigInteger

      public BigInteger asBigInteger()
      Description copied from interface: Parameter

      Converts the parameter value to a big integer.

      Specified by:
      asBigInteger in interface Parameter
      Returns:
      the converted parameter value or null
    • asBigDecimal

      public BigDecimal asBigDecimal()
      Description copied from interface: Parameter

      Converts the parameter value to a big decimal.

      Specified by:
      asBigDecimal in interface Parameter
      Returns:
      the converted parameter value or null
    • asLocalDate

      public LocalDate asLocalDate()
      Description copied from interface: Parameter

      Converts the parameter value to a local date.

      Specified by:
      asLocalDate in interface Parameter
      Returns:
      the converted parameter value or null
    • asLocalDateTime

      public LocalDateTime asLocalDateTime()
      Description copied from interface: Parameter

      Converts the parameter value to a loca date time.

      Specified by:
      asLocalDateTime in interface Parameter
      Returns:
      the converted parameter value or null
    • asZonedDateTime

      public ZonedDateTime asZonedDateTime()
      Description copied from interface: Parameter

      Converts the parameter value to a zoned date time.

      Specified by:
      asZonedDateTime in interface Parameter
      Returns:
      the converted parameter value or null
    • asCurrency

      public Currency asCurrency()
      Description copied from interface: Parameter

      Converts the parameter value to a currency.

      Specified by:
      asCurrency in interface Parameter
      Returns:
      the converted parameter value or null
    • asLocale

      public Locale asLocale()
      Description copied from interface: Parameter

      Converts the parameter value to a locale.

      Specified by:
      asLocale in interface Parameter
      Returns:
      the converted parameter value or null
    • asFile

      public File asFile()
      Description copied from interface: Parameter

      Converts the parameter value to a file.

      Specified by:
      asFile in interface Parameter
      Returns:
      the converted parameter value or null
    • asPath

      public Path asPath()
      Description copied from interface: Parameter

      Converts the parameter value to a path.

      Specified by:
      asPath in interface Parameter
      Returns:
      the converted parameter value or null
    • asURI

      public URI asURI()
      Description copied from interface: Parameter

      Converts the parameter value to a URI.

      Specified by:
      asURI in interface Parameter
      Returns:
      the converted parameter value or null
    • asURL

      public URL asURL()
      Description copied from interface: Parameter

      Converts the parameter value to a URL.

      Specified by:
      asURL in interface Parameter
      Returns:
      the converted parameter value or null
    • asPattern

      public Pattern asPattern()
      Description copied from interface: Parameter

      Converts the parameter value to a pattern.

      Specified by:
      asPattern in interface Parameter
      Returns:
      the converted parameter value or null
    • asInetAddress

      public InetAddress asInetAddress()
      Description copied from interface: Parameter

      Converts the parameter value to an inet address.

      Specified by:
      asInetAddress in interface Parameter
      Returns:
      the converted parameter value or null
    • asClass

      public Class<?> asClass()
      Description copied from interface: Parameter

      Converts the parameter value to a class.

      Specified by:
      asClass in interface Parameter
      Returns:
      the converted parameter value or null
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object