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

@Experimental public interface PropertyBaseSyntax<Handler extends PropertyHandler<?>>
A base interface for syntaxes dealing with properties to extend and use for common utilities.
  • Method Details

    • getBadTypesErrorMessage

      @Nullable default @Nullable String getBadTypesErrorMessage(@NotNull @NotNull Expression<?> expr)
      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

      @NotNull @NotNull Property<Handler> 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

      default String getPropertyName()
      Returns the name of the property for use in toString, e.g. "name", "display name", etc. Defaults to the getProperty()'s name, but can be overridden for custom names.
      Returns:
      The name of the property to use.
    • asProperty

      @Nullable static @Nullable Expression<?> asProperty(Property<?> property, Expression<?> expr)
      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 for
      expr - 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 for
      expr - the expression to check
      Returns:
      a map of classes to property infos for the given expression's return types