Class IdentityConverter

java.lang.Object
org.apache.commons.beanutils.converters.AbstractConverter
dev.orne.beans.converters.IdentityConverter
All Implemented Interfaces:
org.apache.commons.beanutils.Converter

@API(status=STABLE, since="0.1") public class IdentityConverter extends org.apache.commons.beanutils.converters.AbstractConverter
Implementation of Converter that converts Identity instances to and from String using the identity token as String representation. When converting from String instances of TokenIdentity are produced.
Since:
0.1
Version:
1.0, 2020-05
Author:
(w) Iker Hernaez
  • Constructor Details

    • IdentityConverter

      public IdentityConverter()
      Creates a new instance that throws a ConversionException if an error occurs.
    • IdentityConverter

      public IdentityConverter(Identity defaultValue)
      Creates a new instance that returns a default value if an error occurs.
      Parameters:
      defaultValue - The default value to be returned if the value to be converted is missing or an error occurs converting the value
  • Method Details

    • getDefaultType

      @NotNull protected @NotNull Class<?> getDefaultType()
      Specified by:
      getDefaultType in class org.apache.commons.beanutils.converters.AbstractConverter
    • convertToType

      protected <T> T convertToType(@NotNull @NotNull Class<T> type, Object value)
      Specified by:
      convertToType in class org.apache.commons.beanutils.converters.AbstractConverter
    • convertToString

      protected String convertToString(Object value) throws Throwable
      Overrides:
      convertToString in class org.apache.commons.beanutils.converters.AbstractConverter
      Throws:
      Throwable