Package com.linecorp.armeria.common.util
Interface Unwrappable
- All Known Subinterfaces:
Backoff
,Client<I,O>
,GrpcService
,HttpClient
,HttpService
,HttpServiceWithRoutes
,RpcClient
,RpcService
,RpcServiceWithRoutes
,Service<I,O>
,ServiceWithRoutes<I,O>
,THttpClient
,TransientHttpService
,TransientRpcService
,TransientService<I,O>
,WebClient
- All Known Implementing Classes:
AbstractBackoff
,AbstractCircuitBreakerClient
,AbstractCompositeService
,AbstractConcurrencyLimitingClient
,AbstractHttpService
,AbstractRetryingClient
,AbstractThrottlingService
,AbstractUnaryGrpcService
,AbstractUnsafeUnaryGrpcService
,AbstractUnwrappable
,AuthService
,BackoffWrapper
,BraveClient
,BraveService
,CircuitBreakerClient
,CircuitBreakerRpcClient
,ConcurrencyLimitingClient
,ContentPreviewingClient
,ContentPreviewingService
,CorsService
,DecodingClient
,DecoratingClient
,DecoratingService
,DocService
,EncodingService
,FileService
,HealthCheckService
,JettyService
,LoggingClient
,LoggingRpcClient
,LoggingService
,MetricCollectingClient
,MetricCollectingRpcClient
,MetricCollectingService
,PrometheusExpositionService
,RedirectService
,RetryingClient
,RetryingRpcClient
,SimpleCompositeRpcService
,SimpleCompositeService
,SimpleDecoratingClient
,SimpleDecoratingHttpClient
,SimpleDecoratingHttpService
,SimpleDecoratingRpcClient
,SimpleDecoratingRpcService
,SimpleDecoratingService
,ThriftCallService
,ThrottlingRpcService
,ThrottlingService
,THttpService
,TomcatService
,UserClient
public interface Unwrappable
Provides a way to unwrap an object in decorator pattern, similar to down-casting in an inheritance pattern.
-
Method Details
-
as
Unwraps this object into the object of the specifiedtype
. Use this method instead of an explicit downcast. For example:class Foo {} class Bar<T> extends AbstractWrapper<T> { Bar(T delegate) { super(delegate); } } class Qux<T> extends AbstractWrapper<T> { Qux(T delegate) { super(delegate); } } Qux qux = new Qux(new Bar(new Foo())); Foo foo = qux.as(Foo.class); Bar bar = qux.as(Bar.class);
- Parameters:
type
- the type of the object to return- Returns:
- the object of the specified
type
if found, ornull
if not found.
-