Interface PropertyBaseSyntax<Handler extends PropertyHandler<?>>
- Type Parameters:
Handler
- The property handler used for the applicable property.
- All Known Implementing Classes:
PropCondContains
,PropCondIsEmpty
,PropertyBaseCondition
,PropertyBaseExpression
,PropExprAmount
,PropExprCustomName
,PropExprName
,PropExprNumber
,PropExprSize
,PropExprValueOf
A base interface for syntaxes dealing with properties to extend and use for common utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Expression
<?> asProperty
(Property<?> property, Expression<?> expr) Converts the given expression to an expression that returns types that have the given property.default @Nullable String
getBadTypesErrorMessage
(@NotNull Expression<?> expr) Produces a standard error message for use when an expression returns types that do not have the correct property.static <Handler extends PropertyHandler<?>>
PropertyMap<Handler> getPossiblePropertyInfos
(Property<Handler> property, Expression<?> expr) Gets a map of all possible property infos for the given expression's return types.Gets the property this expression represents.default String
Returns the name of the property for use in toString, e.g.
-
Method Details
-
getBadTypesErrorMessage
Produces a standard error message for use when an expression returns types that do not have the correct property.- Parameters:
expr
- The expression that has bad types.- Returns:
- An error message.
-
getProperty
Gets the property this expression represents. This is used to find the appropriate handlers for the expression's input types.- Returns:
- The property this expression represents.
-
getPropertyName
Returns the name of the property for use in toString, e.g. "name", "display name", etc. Defaults to thegetProperty()
's name, but can be overridden for custom names.- Returns:
- The name of the property to use.
-
asProperty
Converts the given expression to an expression that returns types that have the given property. This is useful for ensuring that an expression can be used with a property.- Parameters:
property
- the property to check forexpr
- the expression to convert- Returns:
- an expression that returns types that have the property, or null if no such expression can be created
-
getPossiblePropertyInfos
static <Handler extends PropertyHandler<?>> PropertyMap<Handler> getPossiblePropertyInfos(Property<Handler> property, Expression<?> expr) Gets a map of all possible property infos for the given expression's return types. This is useful for determining which property handlers can be used with an expression.- Type Parameters:
Handler
- the type of the property handler- Parameters:
property
- the property to check forexpr
- the expression to check- Returns:
- a map of classes to property infos for the given expression's return types
-