Class RrpcInterfaceMeta

java.lang.Object
org.apache.juneau.http.remote.RrpcInterfaceMeta

public final class RrpcInterfaceMeta extends Object
Holds resolved metadata for an interface annotated with @Remote.

Built once per interface class and cached for efficient proxy invocation. Use of(Class) to obtain instances.

See Also:
Since:
9.2.1
  • Constructor Details

    • RrpcInterfaceMeta

      public RrpcInterfaceMeta(Class<?> iface, String uri)
      Constructor.

      Provides backwards compatibility with the classic RrpcInterfaceMeta signature; the uri argument is accepted for API parity and is currently ignored by this implementation.

      Unlike of(Class), this constructor includes all public interface methods (matching the classic behavior), not just those annotated with the @Remote* annotations.

      Parameters:
      iface - The interface class. Must not be null.
      uri - Reserved for compatibility with the classic constructor. May be null.
  • Method Details

    • of

      public static RrpcInterfaceMeta of(Class<?> iface)
      Returns the RrpcInterfaceMeta for the given interface, creating and caching it if necessary.
      Parameters:
      iface - The interface class. Must be annotated with Remote. Must not be null.
      Returns:
      The metadata. Never null.
      Throws:
      IllegalArgumentException - If the class is not an interface or not annotated with Remote.
    • getInterface

      public Class<?> getInterface()
      Returns the interface class.
      Returns:
      The interface. Never null.
    • getJavaClass

      public Class<?> getJavaClass()
      Returns the Java class of this interface.

      Alias for getInterface() provided for backwards compatibility with the classic API.

      Returns:
      The Java class. Never null.
    • getMethodsByPath

      Returns the method metadata keyed by the resolved method path.
      Returns:
      An unmodifiable map from path to RrpcInterfaceMethodMeta. Never null.
    • getMethodMetaByPath

      Returns the method metadata for the given path.
      Parameters:
      path - The path. May be null.
      Returns:
      The matching method metadata, or null if no match was found.
    • getBasePath

      public String getBasePath()
      Returns the base path from the Remote annotation.
      Returns:
      The base path. Never null, but may be empty.
    • getBaseUrl

      public String getBaseUrl()
      Returns the interface-level base/host override, or an empty string if none.

      Sourced from Remote.baseUrl() (resolved through VarResolver.DEFAULT). Used as a substitute for the client root URL when neither an @Url parameter nor a method-level baseUrl is in effect; preserves the interface base path + method path + templating.

      Returns:
      The base/host override. Never null, but may be empty.
    • getContentType

      Returns the interface-level default contentType media-type override, or an empty string.

      Sourced from Remote.contentType() (resolved through VarResolver.DEFAULT). Used as the default request-serializer/Content-Type selector for methods that declare no method-level RrpcInterfaceMethodMeta.getContentType().

      Returns:
      The contentType media type. Never null, but may be empty.
    • getAccept

      public String getAccept()
      Returns the interface-level default accept media-type override, or an empty string.

      Sourced from Remote.accept() (resolved through VarResolver.DEFAULT). Used as the default Accept header / response-parser fallback for methods that declare no method-level RrpcInterfaceMethodMeta.getAccept().

      Returns:
      The accept media type. Never null, but may be empty.
    • getHeaders

      Returns the interface-level constant headers to set on every request.

      Includes the headers declared via Remote.headers() plus the client-version header derived from Remote.version()/Remote.versionHeader() (if a version was specified).

      Returns:
      An unmodifiable list of name/value header entries. Never null, but may be empty.
    • getQueryData

      Returns the interface-level constant query parameters to apply to every request.

      Resolved from Remote.queryData() (the "name=value" form, with VarResolver.DEFAULT expansion).

      Returns:
      An unmodifiable list of name/value query entries. Never null, but may be empty.
    • getFormData

      Returns the interface-level constant form-data parameters to apply to every request.

      Resolved from Remote.formData() (the "name=value" form, with VarResolver.DEFAULT expansion).

      Returns:
      An unmodifiable list of name/value form-data entries. Never null, but may be empty.
    • getPartSerializer

      Returns the interface-level custom HttpPartSerializer, or null if none.

      Sourced from @HttpPartMarshalling(serializer=...) declared on the interface. Used as the lowest-precedence default for part serialization: a parameter-level or method-level @HttpPartMarshalling serializer takes precedence over it.

      Returns:
      The resolved part serializer, or null if none is configured.
    • getInterceptorClasses

      Returns the interface-level interceptor classes, or an empty array if none.

      Each class implements the next-gen client-side interceptor SPI and is resolved to an instance by the next-gen RemoteClient (the raw Class<?>[] type avoids a module dependency on juneau-rest-client).

      Returns:
      The interceptor classes. Never null, but may be empty.
    • getTimeout

      public String getTimeout()
      Returns the interface-level default per-call timeout as a duration string, or an empty string.
      Returns:
      The timeout duration string. Never null, but may be empty.
    • getRetries

      public int getRetries()
      Returns the interface-level default max retry attempts, or 0 if retries are disabled.
      Returns:
      The retry count.
    • isRetryNonIdempotent

      public boolean isRetryNonIdempotent()
      Returns whether the interface opts non-idempotent verbs (POST/PATCH) into automatic retries.
      Returns:
      true if non-idempotent retries are opted in at the interface level.
    • isThrowOnError

      public boolean isThrowOnError()
      Returns whether the interface throws a generic exception on an unmatched error response.
      Returns:
      true if throwOnError is set at the interface level.
    • isAllowPrivateUrls

      public boolean isAllowPrivateUrls()
      Returns whether the interface opts its absolute @Remote/@Url/baseUrl() targets out of the default deny-private SSRF guardrail (Remote.allowPrivateUrls()).
      Returns:
      true if allowPrivateUrls is set at the interface level.
    • getMethodMetas

      Returns the method metadata for all annotated methods.
      Returns:
      An unmodifiable map from Method to RrpcInterfaceMethodMeta. Never null.
    • getMethodMeta

      Returns the metadata for the given method, or null if the method has no remote annotation.
      Parameters:
      method - The method. Can be null (returns null).
      Returns:
      The metadata, or null if the method is null or has no remote annotation.
    • toString

      public String toString()
      Overrides:
      toString in class Object