APIdia Launch Partner
Top Description Methods
jdk.jfr

public @Interface Relational

extends Annotation
Annotations
@MetadataDefinition
@Label:Relation
@Retention:RUNTIME
@Target:ANNOTATION_TYPE
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Meta annotation for relational annotations, to be used on an annotation.

The following example shows how a relational annotation can be created and used. The Orderid annotation indicates there is a relation between OrderEvent and OrderLineEvent. if they have the same ID, the order line belongs to the order.

@MetadataDefinition @Relational @Name("com.example.OrderId") @Label("Order ID") @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface OrderId { } @Name("com.example.Order") @Label("Order") @Category("Orders") class OrderEvent extends Event { @Label("Order ID") @OrderId long orderId; @Label("Order Date") @Timestamp long orderDate; } @Name("com.example.OrderLine") @Label("Order Line") @Category("Orders") class OrderLineEvent extends Event { @Label("Order ID") @OrderId long orderId; @Label("Quantity") long quantity; @Label("Product") String product; }
@MetadataDefinition
@Relational
@Name("com.example.OrderId")
@Label("Order ID")
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface OrderId {
}

@Name("com.example.Order")
@Label("Order")
@Category("Orders")
class OrderEvent extends Event {
    @Label("Order ID")
    @OrderId
    long orderId;

    @Label("Order Date")
    @Timestamp
    long orderDate;
}

@Name("com.example.OrderLine")
@Label("Order Line")
@Category("Orders")
class OrderLineEvent extends Event {
    @Label("Order ID")
    @OrderId
    long orderId;

    @Label("Quantity")
    long quantity;

    @Label("Product")
    String product;
}
Since
9

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString