@Override public Object getContext(final Class objectType) { for (final ContextResolver cr : cra) { @SuppressWarnings("unchecked") final Object c = cr.getContext(objectType); if (c != null) { return c; } } return null; }
@Override public Object getContext(final Class objectType) { for (final ContextResolver cr : cra) { @SuppressWarnings("unchecked") final Object c = cr.getContext(objectType); if (c != null) { return c; } } return null; }
public IndexResource(@Context ContextResolver<UIContext> resolver) { context = resolver.getContext(UIContext.class); }
public ClusterResource(@Context ContextResolver<UIContext> resolver) { context = resolver.getContext(UIContext.class); }
public ExplorerResource(@Context ContextResolver<UIContext> resolver) { context = resolver.getContext(UIContext.class); }
public ConfigResource(@Context ContextResolver<UIContext> resolver) { context = resolver.getContext(UIContext.class); }
public UIResource(@Context ContextResolver< UIContext > resolver) { context = resolver.getContext(UIContext.class); tabs = buildTabs(); }
private final JAXBContext getJAXBContext(Class type) throws JAXBException { if (context != null) { JAXBContext c = context.getContext(type); if (c != null) { return c; } } return getStoredJAXBContext(type); }
protected final Unmarshaller getUnmarshaller(Class type) throws JAXBException { if (unmarshaller != null) { Unmarshaller u = unmarshaller.getContext(type); if (u != null) { return u; } } return getJAXBContext(type).createUnmarshaller(); }
/** * Helper method that is called if no config has been explicitly configured. */ protected FastJsonConfig locateConfigProvider(Class<?> type, MediaType mediaType) { if (providers != null) { ContextResolver<FastJsonConfig> resolver = providers.getContextResolver(FastJsonConfig.class, mediaType); if (resolver == null) { resolver = providers.getContextResolver(FastJsonConfig.class, null); } if (resolver != null) { return resolver.getContext(type); } } return fastJsonConfig; }
private Unmarshaller getUnmarshaller(Class type) throws JAXBException { final ContextResolver<Unmarshaller> resolver = mtUnmarshaller.get(); if (resolver != null) { Unmarshaller u = resolver.getContext(type); if (u != null) { return u; } } final JAXBContext ctx = getJAXBContext(type); return (ctx == null) ? null : ctx.createUnmarshaller(); }
private JAXBContext getJAXBContext(Class type) throws JAXBException { final ContextResolver<JAXBContext> resolver = mtContext.get(); if (resolver != null) { JAXBContext c = resolver.getContext(type); if (c != null) { return c; } } return getStoredJaxbContext(type); }
private JAXBContext getJAXBContext(Class type) throws JAXBException { final ContextResolver<JAXBContext> jaxbContextContextResolver = mtContext.get(); if (jaxbContextContextResolver != null) { JAXBContext c = jaxbContextContextResolver.getContext(type); if (c != null) { return c; } } return getStoredJAXBContext(type); }
private JAXBContext getJAXBContext(Class type, MediaType mt) throws JAXBException { final ContextResolver<JAXBContext> cr = jaxrsProviders.getContextResolver(JAXBContext.class, mt); if (cr != null) { JAXBContext c = cr.getContext(type); if (c != null) { return c; } } return getStoredJaxbContext(type); }
private Jsonb getJsonb(Class<?> type) { final ContextResolver<Jsonb> contextResolver = providers.getContextResolver(Jsonb.class, MediaType.APPLICATION_JSON_TYPE); if (contextResolver != null) { return contextResolver.getContext(type); } else { return JsonbSingleton.INSTANCE.getInstance(); } }
/** * Get JAXB unmarshaller for the type. * * @param type Java type to be unmarshalled. * @return JAXB unmarshaller for the given type. * @throws JAXBException in case there's an error retrieving the unmarshaller. */ protected final Unmarshaller getUnmarshaller(Class type) throws JAXBException { final ContextResolver<Unmarshaller> unmarshallerContextResolver = mtUnmarshaller.get(); if (unmarshallerContextResolver != null) { Unmarshaller u = unmarshallerContextResolver.getContext(type); if (u != null) { return u; } } return getJAXBContext(type).createUnmarshaller(); }
/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }
/** * Helper method that is called if no config has been explicitly configured. */ protected FastJsonConfig locateConfigProvider(Class<?> type, MediaType mediaType) { if (providers != null) { ContextResolver<FastJsonConfig> resolver = providers.getContextResolver(FastJsonConfig.class, mediaType); if (resolver == null) { resolver = providers.getContextResolver(FastJsonConfig.class, null); } if (resolver != null) { return resolver.getContext(type); } } return fastJsonConfig; }
private Marshaller getMarshaller(Class type) throws JAXBException { final ContextResolver<Marshaller> resolver = mtMarshaller.get(); if (resolver != null) { Marshaller u = resolver.getContext(type); if (u != null) { return u; } } final JAXBContext ctx = getJAXBContext(type); if (ctx == null) { return null; } Marshaller m = ctx.createMarshaller(); if (formattedOutput.get()) { m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, formattedOutput.get()); } return m; }
private Map<String, Object> getProperties(final boolean forMarshaller) { final Map<String, Object> properties = new HashMap<>(forMarshaller ? getGlobalConfig().getMarshallerProperties() : getGlobalConfig().getUnmarshallerProperties()); final ContextResolver<MoxyJsonConfig> contextResolver = providers.getContextResolver(MoxyJsonConfig.class, MediaType.APPLICATION_JSON_TYPE); if (contextResolver != null) { final MoxyJsonConfig jsonConfiguration = contextResolver.getContext(MoxyJsonConfig.class); if (jsonConfiguration != null) { properties.putAll(forMarshaller ? jsonConfiguration.getMarshallerProperties() : jsonConfiguration.getUnmarshallerProperties()); } } return properties; }