Annotation Type Creator

  • @Retention(RUNTIME)
    public @interface Creator
    Creator methods produce instances of specific classes.

    Consider DescriptorCalculator - DescriptorComparator relation: creation of comparators depends on the actual calculator implementation (which depends on the actual descriptor). The valid parameter classes for such creators thus can be specified only by the actual calculator implementation.

    This annotation is used to mark such methods explicitly.

    Note that the information carried by this annotation is implicitly already available in the actual classes, so we might eliminate it later. Currently it seems a good practice to expose this contract explicitly.

    Since API discovery uses Class.getMethods() internally the order of the listed creators - and the order of their display - is not defined. To circumvent this problem an explicit order info is introduced.

    Please note that this annotation is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      int order
      Order info for the listed creators of this type.
    • Element Detail

      • order

        int order
        Order info for the listed creators of this type.

        The creator discovery will list creators by this value in increasing order.

        Expected order