Annotation Interface Bind.DefaultExpression

Enclosing class:
Bind

@Retention(CLASS) @Target(TYPE) @Inherited public static @interface Bind.DefaultExpression
Defines a default bind expression for a given type. When a type defines a default bind expression, specialization methods can declare bind parameters of the type without specifying a bind expression; the DSL will automatically use the default expression for the type.

Usage example:

@Bind.DefaultExpression("get($node)")
public final class MyLanguageContext {
    // ...
    public static MyLanguageContext get(Node node) {
        // ...
    }
}

abstract static class NodeWithBinding extends Node {
    abstract Object execute();

    @Specialization
    Object perform(@Bind("MyLanguageContext.get($node)") MyLanguageContext boundWithExplicitExpression,
                    @Bind MyLanguageContext boundWithDefaultExpression) {
        // ...
    }
}
Since:
24.2
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The default expression to be used for a particular type.
  • Element Details

    • value

      String value
      The default expression to be used for a particular type.
      Since:
      24.2
      See Also: