Refine search
@Override public TokenResult readFrom(final Class<TokenResult> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException, WebApplicationException { final GenericType<Map<String, Object>> mapType = new GenericType<Map<String, Object>>() { }; final Map<String, Object> map = (Map<String, Object>) workers.get().readFrom(mapType.getRawType(), mapType.getType(), annotations, mediaType, httpHeaders, propertiesDelegateProvider.get(), entityStream, EMPTY_INTERCEPTORS, false); return new TokenResult(map); } }
/** * Start building a new generic type-based service binding. * <p> * Binds the generic service type itself as a contract type. * * @param <T> service type. * @param serviceType generic service type information. * @return initialized binding builder. */ @SuppressWarnings("unchecked") public static <T> ClassBinding<T> serviceAsContract(GenericType<T> serviceType) { return (ClassBinding<T>) new ClassBinding<>(serviceType.getRawType()) .asType((Class<T>) serviceType.getType()) .to(serviceType.getType()); }
/** * Start building a new generic type-based service binding. * <p> * Binds the generic service type itself as a contract type. * * @param <T> service type. * @param serviceType generic service type information. * @return initialized binding builder. */ @SuppressWarnings("unchecked") public static <T> ClassBinding<T> serviceAsContract(GenericType<T> serviceType) { return (ClassBinding<T>) new ClassBinding<>(serviceType.getRawType()) .asType((Class<T>) serviceType.getType()) .to(serviceType.getType()); }
@SuppressWarnings("unchecked") private <T> T readAndCast(GenericType<T> type, MediaType effectiveMediaType, MessageBodyReader reader) { try { return (T) reader.readFrom( type.getRawType(), type.getType(), annotations, effectiveMediaType, headers, new ByteArrayInputStream(data)); } catch (IOException ex) { throw new ProcessingException(ex); } }
/** * Start building a new generic type-based service binding. * <p> * Binds the generic service type itself as a contract type. * * @param <T> service type. * @param serviceType generic service type information. * @return initialized binding builder. */ @SuppressWarnings("unchecked") public static <T> ClassBinding<T> service(GenericType<T> serviceType) { return (ClassBinding<T>) new ClassBinding<>(serviceType.getRawType()) .asType((Class<T>) serviceType.getType()); }
/** * Start building a new generic type-based service binding. * <p> * Binds the generic service type itself as a contract type. * * @param <T> service type. * @param serviceType generic service type information. * @return initialized binding builder. */ @SuppressWarnings("unchecked") public static <T> ClassBinding<T> service(GenericType<T> serviceType) { return (ClassBinding<T>) new ClassBinding<>(serviceType.getRawType()) .asType((Class<T>) serviceType.getType()); }
Class<?> parameterClass = pair.genericType.getRawType(); final Type type = pair.genericType.getType();
Class<?> parameterClass = pair.genericType.getRawType(); final Type type = pair.genericType.getType();
public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) throws ProcessingException, IllegalStateException { return (T) readEntity(entityType.getRawType(), entityType.getType(), annotations, requestContext.getPropertiesDelegate());
return (T) readEntity(entityType.getRawType(), entityType.getType(), requestContext.getPropertiesDelegate());
return (T) readEntity(entityType.getRawType(), entityType.getType(), requestContext.getPropertiesDelegate());
public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) throws ProcessingException, IllegalStateException { return (T) readEntity(entityType.getRawType(), entityType.getType(), annotations, requestContext.getPropertiesDelegate());
final Class<?> clazz = genericType.getRawType(); } else if (SPECIAL_GENERIC_TYPES.contains(clazz)) { final Type type = genericType.getType(); if (type instanceof ParameterizedType) { final Type parameterType = ((ParameterizedType) type).getActualTypeArguments()[0];
/** * Read event data as a given generic type. * * @param type generic type to be used for event data de-serialization. * @param mediaType {@link MediaType media type} to be used for event data de-serialization. * @return event data de-serialized as an instance of a given type. * @throws javax.ws.rs.ProcessingException when provided type can't be read. The thrown exception wraps the original cause. * @since 2.3 */ public <T> T readData(GenericType<T> type, MediaType mediaType) { final MediaType effectiveMediaType = mediaType == null ? this.mediaType : mediaType; final MessageBodyReader reader = messageBodyWorkers.getMessageBodyReader(type.getRawType(), type.getType(), annotations, mediaType); if (reader == null) { throw new MessageBodyProviderNotFoundException(LocalizationMessages.EVENT_DATA_READER_NOT_FOUND()); } return readAndCast(type, effectiveMediaType, reader); }
final Class<?> clazz = genericType.getRawType(); } else if (SPECIAL_GENERIC_TYPES.contains(clazz)) { final Type type = genericType.getType(); if (type instanceof ParameterizedType) { final Type parameterType = ((ParameterizedType) type).getActualTypeArguments()[0];
return (T) readEntity(entityType.getRawType(), entityType.getType(), requestContext.getPropertiesDelegate());
public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) throws ProcessingException, IllegalStateException { return (T) readEntity(entityType.getRawType(), entityType.getType(), annotations, requestContext.getPropertiesDelegate());
private void ensureMediaType() { if (getMediaType() == null) { // Content-Type is not present choose a default type final GenericType<?> entityType = new GenericType(getEntityType()); final List<MediaType> mediaTypes = workers.getMessageBodyWriterMediaTypes( entityType.getRawType(), entityType.getType(), getEntityAnnotations()); setMediaType(getMediaType(mediaTypes)); } }
private void ensureMediaType() { if (getMediaType() == null) { // Content-Type is not present choose a default type final GenericType<?> entityType = new GenericType(getEntityType()); final List<MediaType> mediaTypes = workers.getMessageBodyWriterMediaTypes( entityType.getRawType(), entityType.getType(), getEntityAnnotations()); setMediaType(getMediaType(mediaTypes)); } }
} else { GenericType routingResponseGenericType = new GenericType(routingResponseType); this.routingResponseType = routingResponseGenericType.getType(); this.rawRoutingResponseType = routingResponseGenericType.getRawType();