Interface Dependency

All Superinterfaces:
Prototype.Api
All Known Implementing Classes:
Dependency.BuilderBase.DependencyImpl

public interface Dependency extends Prototype.Api
Dependency metadata. The basic dependency supports other services to be passed to a constructor parameter. The dependency may be a contract, List of contracts, or an Optional of contract, or Supplier of any of these.
See Also:
  • Method Details

    • builder

      static Dependency.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static Dependency.Builder builder(Dependency instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static Dependency create()
      Create a new instance with default values.
      Returns:
      a new instance
    • service

      TypeName service()
      Type name of the service that uses this dependency.
      Returns:
      the service declaring this dependency
    • name

      String name()
      Name of the constructor parameter.
      Returns:
      unique name of the parameter
    • contract

      TypeName contract()
      Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example for List<MyService>, the contract is MyService.
      Returns:
      contract of the service we depend on
    • contractType

      GenericType<?> contractType()
      Generic type equivalent to DependencyBlueprint.contract(). We need both, to prevent reflection at runtime.
      Returns:
      generic type of the dependency
    • descriptor

      TypeName descriptor()
      Descriptor declaring this dependency. Descriptor is always public.
      Returns:
      descriptor
    • descriptorConstant

      String descriptorConstant()
      Field name that declares this dependency in the DependencyBlueprint.descriptor(). Can be used for code generation. This field is always a public constant.
      Returns:
      field that has the dependency on the descriptor type
    • typeName

      TypeName typeName()
      Type of the dependency (exact parameter type with all generics).
      Returns:
      type of the dependency as TypeName