Class ConverterLocator

  • All Implemented Interfaces:
    java.io.Serializable, IConverterLocator, org.apache.wicket.util.io.IClusterable

    public class ConverterLocator
    extends java.lang.Object
    implements IConverterLocator
    Implementation of IConverterLocator interface, which locates converters for a given type. It serves as a registry for IConverter instances stored by type, and is the default locator for Wicket.
    Author:
    Eelco Hillenius, Jonathan Locke
    See Also:
    IConverterLocator, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ConverterLocator()
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <C> org.apache.wicket.util.convert.IConverter<C> get​(java.lang.Class<C> c)
      Gets the type converter that is registered for class c.
      <C> org.apache.wicket.util.convert.IConverter<C> getConverter​(java.lang.Class<C> type)
      Converts the given value to class c.
      org.apache.wicket.util.convert.IConverter<?> remove​(java.lang.Class<?> c)
      Removes the type converter currently registered for class c.
      org.apache.wicket.util.convert.IConverter<?> set​(java.lang.Class<?> c, org.apache.wicket.util.convert.IConverter<?> converter)
      Registers a converter for use with class c.
      • Methods inherited from class java.lang.Object

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

      • ConverterLocator

        public ConverterLocator()
        Constructor
    • Method Detail

      • get

        public final <C> org.apache.wicket.util.convert.IConverter<C> get​(java.lang.Class<C> c)
        Gets the type converter that is registered for class c.
        Type Parameters:
        C - The object to convert from and to String
        Parameters:
        c - The class to get the type converter for
        Returns:
        The type converter that is registered for class c or null if no type converter was registered for class c
      • getConverter

        public final <C> org.apache.wicket.util.convert.IConverter<C> getConverter​(java.lang.Class<C> type)
        Converts the given value to class c.
        Specified by:
        getConverter in interface IConverterLocator
        Type Parameters:
        C - The object to convert from and to String
        Parameters:
        type - Class to get the converter for.
        Returns:
        The converter for the given type
        See Also:
        IConverter.convertToObject(String, java.util.Locale)
      • remove

        public final org.apache.wicket.util.convert.IConverter<?> remove​(java.lang.Class<?> c)
        Removes the type converter currently registered for class c.
        Parameters:
        c - The class for which the converter registration should be removed
        Returns:
        The converter that was registered for class c before removal or null if none was registered
      • set

        public final org.apache.wicket.util.convert.IConverter<?> set​(java.lang.Class<?> c,
                                                                      org.apache.wicket.util.convert.IConverter<?> converter)
        Registers a converter for use with class c.
        Parameters:
        converter - The converter to add
        c - The class for which the converter should be used
        Returns:
        The previous registered converter for class c or null if none was registered yet for class c