Package org.prolog4j

Class Converter<T>

  • Type Parameters:
    T - the type of the objects to convert

    public abstract class Converter<T>
    extends Object
    Converter instances can convert objects of type T to another object.
    • Constructor Detail

      • Converter

        public Converter()
    • Method Detail

      • convert

        public abstract Object convert​(T term)
        Converts an object to another one. If the conversion is not applicable then it returns null.
        Parameters:
        term - the object to convert
        Returns:
        the result of the conversion or null if the object cannot be converted
      • convert

        public <R> R convert​(T object,
                             Class<R> to)
        Converts an object to another one of a specific type. If the conversion is not applicable then it returns null.
        Type Parameters:
        R - the type
        Parameters:
        object - the object to convert
        to - the type to convert to
        Returns:
        the result of the conversion or null if the object cannot be converted