Package com.shri.restinpeace.validator
Class ReflectiveRestClientValidator
java.lang.Object
com.shri.restinpeace.validator.ReflectiveRestClientValidator
Validates a
@RestClient interface before
RIP.getClient(Class) hands back a proxy for
it, so a misconfigured interface fails fast with a complete list of
problems instead of failing later on the first call.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidValidates the given interface, collecting every problem found (missing@RestClient, missing/duplicate HTTP method annotations, invalid URLs, unmatched path params, misused@Body, unsupportedCompletableFuturetype parameters) rather than stopping at the first one.static <T> voidSame asvalidate(Class), but a relative method URL is validated againstbaseUrlOverrideinstead of requiring@BaseUrlon the interface - forRIP.getClient(Class, String), where the base URL is supplied at runtime instead of declared on the interface.
-
Method Details
-
validate
Validates the given interface, collecting every problem found (missing@RestClient, missing/duplicate HTTP method annotations, invalid URLs, unmatched path params, misused@Body, unsupportedCompletableFuturetype parameters) rather than stopping at the first one.- Type Parameters:
T- the rest client interface type- Parameters:
restClient- the interface to validate- Throws:
RestInPeaceValidationException- if any validation error is found
-
validate
public static <T> void validate(Class<T> restClient, String baseUrlOverride) throws RestInPeaceValidationException Same asvalidate(Class), but a relative method URL is validated againstbaseUrlOverrideinstead of requiring@BaseUrlon the interface - forRIP.getClient(Class, String), where the base URL is supplied at runtime instead of declared on the interface.- Type Parameters:
T- the rest client interface type- Parameters:
restClient- the interface to validatebaseUrlOverride- the runtime base URL a relative method URL is validated against, ornullto require@BaseUrlon the interface instead- Throws:
RestInPeaceValidationException- if any validation error is found
-