Interface Converter<F,T>

Type Parameters:
F - The type to convert from.
T - The type to convert to.
All Known Implementing Classes:
EnumParser, ExprDisplayBillboard, ExprDisplayGlowOverride, ExprDisplayHeightWidth, ExprDisplayInterpolation, ExprDisplayShadow, ExprDisplayTeleportDuration, ExprDisplayTransformationRotation, ExprDisplayTransformationScaleTranslation, ExprDisplayViewRange, ExprItemDisplayTransform, ExprItemOfEntity, ExprLootContextEntity, ExprLootContextLocation, ExprLootContextLooter, ExprLootContextLuck, ExprLootTable, ExprLootTableSeed, ExprLoveTime, ExprQuaternionAxisAngle, ExprTagKey, ExprTextDisplayAlignment, ExprTextDisplayLineWidth, ExprTextDisplayOpacity, ExprTextOf, Getter, ch.njol.skript.expressions.base.SimplePropertyExpression
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Converter<F,T>
Used to convert an object to a different type.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A Converter flag declaring that this Converter can be any part of a chain.
    static final int
    A Converter flag declaring that the input/output of this can use an unchecked cast, when combined with NO_LEFT_CHAINING or NO_RIGHT_CHAINING.
    static final int
    A Converter flag declaring that this Converter cannot be a part of a chain.
    static final int
    A Converter flag declaring this Converter cannot be chained to another Converter.
    static final int
    A Converter flag declaring that another Converter cannot be chained to this Converter.
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(F from)
    Converts an object using this Converter.
  • Field Details

    • ALL_CHAINING

      static final int ALL_CHAINING
      A Converter flag declaring that this Converter can be any part of a chain.
      See Also:
    • NO_LEFT_CHAINING

      static final int NO_LEFT_CHAINING
      A Converter flag declaring this Converter cannot be chained to another Converter. This means that this Converter must be the beginning of a chain.
      Note: unchecked casts are not permitted before this converter (e.g. Object to ).
      See Also:
    • NO_RIGHT_CHAINING

      static final int NO_RIGHT_CHAINING
      A Converter flag declaring that another Converter cannot be chained to this Converter. This means that this Converter must be the end of a chain.
      Note: unchecked casts are not permitted after this converter (e.g. to ).
      See Also:
    • ALLOW_UNSAFE_CASTS

      static final int ALLOW_UNSAFE_CASTS
      A Converter flag declaring that the input/output of this can use an unchecked cast, when combined with NO_LEFT_CHAINING or NO_RIGHT_CHAINING.
      An unchecked cast would be Number -> Integer. (Not all numbers are integers, some are floats!)

      When combined with NO_RIGHT_CHAINING the output can be conformed with an unchecked cast, e.g. String -> Number (-> cast Integer).
      When combined with NO_RIGHT_CHAINING the output can be conformed with an unchecked cast, e.g. (cast Object ->) Integer -> String.
      See Also:
    • NO_CHAINING

      static final int NO_CHAINING
      A Converter flag declaring that this Converter cannot be a part of a chain.
      See Also:
  • Method Details

    • convert

      @Nullable T convert(F from)
      Converts an object using this Converter.
      Parameters:
      from - The object to convert.
      Returns:
      The converted object.