Interface Converter<F,T>
- Type Parameters:
F- The type to convert from.T- The type to convert to.
- All Known Subinterfaces:
Converter<F,,T> EventConverter<E,T>
- All Known Implementing Classes:
EnumParser,EnumParser,ExprBrewingFuelLevel,ExprCausingEntity,ExprDamageLocation,ExprDamageType,ExprDirectEntity,ExprDisplayBillboard,ExprDisplayGlowOverride,ExprDisplayHeightWidth,ExprDisplayInterpolation,ExprDisplayShadow,ExprDisplayTeleportDuration,ExprDisplayTransformationRotation,ExprDisplayTransformationScaleTranslation,ExprDisplayViewRange,ExprEquipCompCameraOverlay,ExprEquipCompEquipSound,ExprEquipCompModel,ExprEquipCompShearSound,ExprEquipCompSlot,ExprEquippableComponent,ExprFoodExhaustion,ExprItemCompCopy,ExprItemDisplayTransform,ExprItemOfEntity,ExprLootContextEntity,ExprLootContextLocation,ExprLootContextLooter,ExprLootContextLuck,ExprLootTable,ExprLootTableSeed,ExprLoveTime,ExprQuaternionAxisAngle,ExprSourceLocation,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.
Used to convert an object to a different type.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA Converter flag declaring that this Converter can be any part of a chain.static final intA Converter flag declaring that the input/output of this can use an unchecked cast, when combined withNO_LEFT_CHAININGorNO_RIGHT_CHAINING.static final intA Converter flag declaring that this Converter cannot be a part of a chain.static final intA Converter flag declaring this Converter cannot be chained to another Converter.static final intA Converter flag declaring that another Converter cannot be chained to this Converter. -
Method Summary
-
Field Details
-
ALL_CHAINING
static final int ALL_CHAININGA Converter flag declaring that this Converter can be any part of a chain.- See Also:
-
NO_LEFT_CHAINING
static final int NO_LEFT_CHAININGA 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.Objectto ).- See Also:
-
NO_RIGHT_CHAINING
static final int NO_RIGHT_CHAININGA 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_CASTSA Converter flag declaring that the input/output of this can use an unchecked cast, when combined withNO_LEFT_CHAININGorNO_RIGHT_CHAINING.
An unchecked cast would beNumber -> Integer. (Not all numbers are integers, some are floats!)
When combined withNO_RIGHT_CHAININGthe output can be conformed with an unchecked cast, e.g.String -> Number (-> cast Integer).
When combined withNO_RIGHT_CHAININGthe output can be conformed with an unchecked cast, e.g.(cast Object ->) Integer -> String.- See Also:
-
NO_CHAINING
static final int NO_CHAININGA Converter flag declaring that this Converter cannot be a part of a chain.- See Also:
-
-
Method Details
-
convert
Converts an object using this Converter.- Parameters:
from- The object to convert.- Returns:
- The converted object.
-