Class Converter.ConverterUtils

java.lang.Object
ch.njol.skript.classes.Converter.ConverterUtils
Enclosing interface:
Converter<F,T>

public static final class Converter.ConverterUtils extends Object
  • Constructor Details

    • ConverterUtils

      public ConverterUtils()
  • Method Details

    • createInstanceofConverter

      public static <F, T> Converter<?,T> createInstanceofConverter(Converter.ConverterInfo<F,T> conv)
    • createInstanceofConverter

      public static <F, T> Converter<?,T> createInstanceofConverter(Class<F> from, Converter<F,T> conv)
    • createInstanceofConverter

      public static <F, T> Converter<F,T> createInstanceofConverter(Converter<F,?> conv, Class<T> to)
      Wraps a converter in a filter that will only accept conversion results of given type. All other results are replaced with nulls.
      Parameters:
      conv - Converter to wrap.
      to - Accepted return type of the converter.
      Returns:
      The wrapped converter.
    • createDoubleInstanceofConverter

      public static <F, T> Converter<?,T> createDoubleInstanceofConverter(Converter.ConverterInfo<F,?> conv, Class<T> to)
    • createDoubleInstanceofConverter

      public static <F, T> Converter<?,T> createDoubleInstanceofConverter(Class<F> from, Converter<F,?> conv, Class<T> to)
      Wraps a converter. When values given to the wrapper converter are not of accepted type, it will not be called; instead, a null is returned. When it returns a value that is not of accepted type, the wrapped converter will return null instead.
      Parameters:
      from - Accepted type of input.
      conv - Converter to wrap.
      to - Accepted type of output.
      Returns:
      A wrapped converter.