Interface BuilderCreatorProvider


public interface BuilderCreatorProvider
Java ServiceLoader provider interface used to discover builder creators.

Implementors of this contract will be called to process BuilderTrigger-annotated annotation types that they know how to handle. This is based upon the supportedAnnotationTypes() as well as the Weight assigned to the implementation class implementing this interface.

  • Method Details

    • supportedAnnotationTypes

      Set<Class<? extends Annotation>> supportedAnnotationTypes()
      The set of Builder-like annotations that this creator knows how to handle. Note that this annotation must also be annotated with BuilderTrigger to qualify for inclusion. This is akin to Processor.getSupportedAnnotationTypes().
      Returns:
      Implementors should return the set of annotations they can handle
    • create

      List<TypeAndBody> create(TypeInfo typeInfo, AnnotationAndValue builderAnnotation)
      Creates the type and body for what is code generated. Implementors should return and empty list if the given typeInfo is not supported by this creator. Note that the actual code generation is provided directly by the built-in builder tooling module. Implementors, therefore, should only return the TypeAndBody that describes the code generated class, and only if they are prepared to code generate the builder implementation.
      Parameters:
      typeInfo - the target type being processed - this type was found to have one of our supported annotations mentioned in supportedAnnotationTypes()
      builderAnnotation - the annotation that triggered the builder creation
      Returns:
      the list of TypeAndBody sources to code-generate (tooling will handle the actual code generation aspects), or empty list to signal that the target type is not handled