Interface Request<S extends ProtoSession>

Type Parameters:
S - the type of ProtoSession associated with this request, allowing for type-safe session handling in specific request implementations
All Known Subinterfaces:
ArtifactCoordinatesFactoryRequest, ArtifactDeployerRequest, ArtifactFactoryRequest, ArtifactInstallerRequest, ArtifactResolverRequest, DependencyCoordinatesFactoryRequest, DependencyResolverRequest, ModelBuilderRequest, ProjectBuilderRequest, SettingsBuilderRequest, ToolchainsBuilderRequest, VersionRangeResolverRequest, VersionResolverRequest
All Known Implementing Classes:
DefaultModelBuilder.RgavCacheKey, DefaultModelBuilder.SourceCacheKey, ModelResolver.ModelResolverRequest

@Experimental @Immutable public interface Request<S extends ProtoSession>
Base interface for service requests in Maven. This interface defines the common contract for all request types within the Maven service layer, providing access to session context and request tracing capabilities.

Each request is associated with a ProtoSession that contains the configuration and context necessary for request processing, including:

  • User and system properties for interpolation
  • Session start time information
  • Project directory structures

Requests can optionally carry trace information through RequestTrace to support:

  • Debugging and troubleshooting of request flows
  • Audit logging of operations
  • Performance monitoring of nested operations

This interface is designed to be extended by specific request types that handle different Maven operations. All implementations must be immutable to ensure thread safety and predictable behavior in concurrent environments.

Since:
4.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the specified object is equal to this request.
    Returns the session associated with this request.
    Returns the trace information associated with this request, if any.
    int
    Returns a hashcode value for this request, based on all significant fields.
    Returns a string representation of this request, used for debugging and logging purposes.
  • Method Details

    • getSession

      @Nonnull S getSession()
      Returns the session associated with this request.
      Returns:
      the session instance, never null
    • getTrace

      Returns the trace information associated with this request, if any. The trace provides context about the request's position in the operation hierarchy and can carry additional diagnostic information.
      Returns:
      the request trace, or null if no trace information is available
    • hashCode

      int hashCode()
      Returns a hashcode value for this request, based on all significant fields. Implementations must ensure that if two requests are equal according to equals(Object), they have the same hashcode.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this request
    • equals

      boolean equals(Object obj)
      Returns true if the specified object is equal to this request. Two requests are considered equal if they have the same type and all significant fields are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with this request
      Returns:
      true if the objects are equal, false otherwise
    • toString

      @Nonnull String toString()
      Returns a string representation of this request, used for debugging and logging purposes. The format should include the request type and any significant attributes that define the request's state.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this request, never null