Class RestExtensionBase

java.lang.Object
io.helidon.declarative.codegen.http.RestExtensionBase

public abstract class RestExtensionBase extends Object
A base class for HTTP Rest extensions (server and client).
  • Constructor Details

    • RestExtensionBase

      protected RestExtensionBase()
      Constructor with no side effects.
  • Method Details

    • httpMethodFromAnnotation

      protected HttpMethod httpMethodFromAnnotation(TypedElementInfo element, Annotation httpMethodAnnotation)
      Extract HTTP Method from its annotation.
      Parameters:
      element - annotated element
      httpMethodAnnotation - Http method annotation
      Returns:
      http method abstraction for code generation
    • path

      protected void path(Set<Annotation> annotations, HttpAnnotated.BuilderBase<?,?> builder)
      Find path in the annotations and set it on the builder.
      Parameters:
      annotations - all element annotations
      builder - element builder
    • consumes

      protected void consumes(Set<Annotation> annotations, HttpAnnotated.BuilderBase<?,?> builder)
      Find consumes in the annotations and set it on the builder.
      Parameters:
      annotations - all element annotations
      builder - element builder
    • produces

      protected void produces(Set<Annotation> annotations, HttpAnnotated.BuilderBase<?,?> builder)
      Find produces in the annotations and set it on the builder.
      Parameters:
      annotations - all element annotations
      builder - element builder
    • headers

      protected void headers(Set<Annotation> annotations, HttpAnnotated.BuilderBase<?,?> builder, TypeName repeatedAnnotationType, TypeName singleAnnotationType)
      Find headers in the annotations and set it on the builder.
      Parameters:
      annotations - all element annotations
      builder - element builder
      repeatedAnnotationType - type of the annotation to be found (repeated)
      singleAnnotationType - type of the annotation to be found (single)
    • computedHeaders

      protected void computedHeaders(Set<Annotation> annotations, HttpAnnotated.BuilderBase<?,?> builder, TypeName repeatedAnnotationType, TypeName singleAnnotationType)
      Find computed headers in the annotations and set it on the builder.
      Parameters:
      annotations - all element annotations
      builder - element builder
      repeatedAnnotationType - type of the annotation to be found (repeated)
      singleAnnotationType - type of the annotation to be found (single)
    • supplierOf

      protected TypeName supplierOf(TypeName type)
      Create a type name that is a supplier of the provided type.
      Parameters:
      type - type to supply
      Returns:
      supplier type
    • headerProducers

      protected Map<String,String> headerProducers(FieldHandler fieldHandler, RestEndpoint endpoint)
      Find all header producers and create appropriate fields, parameters, and assignments for them.
      Parameters:
      fieldHandler - field handler for the current generated type
      endpoint - rest endpoint to analyze
      Returns:
      map of names (as in named services) to field names
    • findMetaAnnotated

      protected Optional<Annotation> findMetaAnnotated(TypeName metaAnnotation, Set<Annotation> annotations)
      Find an annotation with the provided "meta-annotation".
      Parameters:
      metaAnnotation - type of the meta annotation we are looking for
      annotations - set of annotations on the element
      Returns:
      the meta annotation instance, or empty optional if not found