org.glassfish.jersey.server.internal.inject.ParamInjectionResolver Java Examples

The following examples show how to use org.glassfish.jersey.server.internal.inject.ParamInjectionResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProviderRenderUtil.java    From dropwizard-guicey with MIT License 6 votes vote down vote up
private static String renderParamInjectionResolver(final ParamInjectionResolver instance,
                                                   final boolean hkManaged,
                                                   final boolean lazy) {
    try {
        final Field field = ParamInjectionResolver.class.getDeclaredField("valueParamProvider");
        field.setAccessible(true);
        final ValueParamProvider param = (ValueParamProvider) field.get(instance);
        final Class<? extends ParamInjectionResolver> type = instance.getClass();
        return String.format("@%-30s %s using %s %s",
                instance.getAnnotation().getSimpleName(),
                RenderUtils.renderClassLine(type),
                param.getClass().getSimpleName(),
                RenderUtils.markers(collectMarkers(InjectionResolver.class, type, hkManaged, lazy)));
    } catch (Exception e) {
        throw new IllegalStateException("Failed to access provider field", e);
    }
}
 
Example #2
Source File: ProviderRenderUtil.java    From dropwizard-guicey with MIT License 5 votes vote down vote up
/**
 * In fuw cases it is possible to get more information using provider instance. So this report
 * will be a bit more detailed comparing to {@link #render(Class, Class, boolean, boolean)}.
 *
 * @param ext         extension type (affects render format)
 * @param instance    provider instance
 * @param isHkManaged true if extension is managed with HK2
 * @param isLazy      true if extension is annotated with
 *                    {@link ru.vyarus.dropwizard.guice.module.installer.install.binding.LazyBinding}
 * @return rendered provider line
 */
public static String render(final Class<?> ext,
                            final Object instance,
                            final boolean isHkManaged,
                            final boolean isLazy) {
    final Class<?> type = instance.getClass();
    String res = null;
    if (ParamInjectionResolver.class.isAssignableFrom(type)) {
        res = renderParamInjectionResolver((ParamInjectionResolver) instance, isHkManaged, isLazy);
    } else if (ext.equals(InjectionResolver.class)) {
        res = renderInjectionResolver((InjectionResolver) instance, isHkManaged, isLazy);
    }
    return res == null ? render(ext, type, isHkManaged, isLazy) : res;
}
 
Example #3
Source File: HmacAuthFeature.java    From jersey-hmac-auth with Apache License 2.0 5 votes vote down vote up
protected void configure() {
    bind(PrincipalFactory.class)
            .to(PrincipalFactory.class)
            .to(new TypeLiteral<Factory<P>>() {})
            .in(Singleton.class);
    bind(PrincipalValueFactoryProvider.class)
            .to(AbstractValueFactoryProvider.class)
            .to(ValueFactoryProvider.class)
            .in(Singleton.class);
    bind(PrincipalInjectionResolver.class)
            .to(new TypeLiteral<ParamInjectionResolver<HmacAuth>>() {})
            .to(new TypeLiteral<InjectionResolver<HmacAuth>>() {})
            .in(Singleton.class);
}