@SuppressWarnings("unchecked") @Override protected void configure() { TypeToken<?> concreteType = BaseRestApiMetadata.contextToken(typeToken(restApiMetadata.getApi()), typeToken(restApiMetadata.getAsyncApi())); // bind explicit type bind(TypeLiteral.get(concreteType.getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); // bind potentially wildcard type if (!concreteType.equals(restApiMetadata.getContext())) { bind(TypeLiteral.get(restApiMetadata.getContext().getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } // bind w/o types bind(TypeLiteral.get(RestContext.class)).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } }
@SuppressWarnings("unchecked") @Override protected void configure() { TypeToken<?> concreteType = BaseRestApiMetadata.contextToken(typeToken(restApiMetadata.getApi()), typeToken(restApiMetadata.getAsyncApi())); // bind explicit type bind(TypeLiteral.get(concreteType.getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); // bind potentially wildcard type if (!concreteType.equals(restApiMetadata.getContext())) { bind(TypeLiteral.get(restApiMetadata.getContext().getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } // bind w/o types bind(TypeLiteral.get(RestContext.class)).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } }
@SuppressWarnings("unchecked") @Override protected void configure() { TypeToken<?> concreteType = BaseRestApiMetadata.contextToken(typeToken(restApiMetadata.getApi()), typeToken(restApiMetadata.getAsyncApi())); // bind explicit type bind(TypeLiteral.get(concreteType.getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); // bind potentially wildcard type if (!concreteType.equals(restApiMetadata.getContext())) { bind(TypeLiteral.get(restApiMetadata.getContext().getType())).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } // bind w/o types bind(TypeLiteral.get(RestContext.class)).to( TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class, restApiMetadata.getApi(), restApiMetadata.getAsyncApi())))); } }