Interface ServerResourceProducer

All Known Implementing Classes:
DeploymentManagerProducer, ModelControllerClientProducer, ServerManagerProducer, UriProducer

public interface ServerResourceProducer
An implementation of this interface is used to inject static fields, instance fields and parameters. For static fields and instance fields, the field must be annotated with ServerResource.
Author:
James R. Perkins
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canInject(ExtensionContext context, Class<?> clazz, Annotation... annotations)
    Indicates the type can be produced from this producer.
    produce(ExtensionContext context, Class<?> clazz, Annotation... annotations)
    Creates the object which can be injected into a static field, an instance field or a parameter.
  • Method Details

    • canInject

      boolean canInject(ExtensionContext context, Class<?> clazz, Annotation... annotations)
      Indicates the type can be produced from this producer.
      Parameters:
      context - the current extension context
      clazz - the type to check
      annotations - the annotations, if any, for the field or parameter
      Returns:
      true if this producer can create this type, otherwise false
    • produce

      Object produce(ExtensionContext context, Class<?> clazz, Annotation... annotations) throws IllegalArgumentException
      Creates the object which can be injected into a static field, an instance field or a parameter.
      Parameters:
      context - the current extension context
      clazz - the type of the field or parameter
      annotations - the annotations, if any, for the field or parameter
      Returns:
      the newly constructed object or null if it could not be produced
      Throws:
      IllegalArgumentException - if the type cannot be assigned to the type this producer can produce