Package com.hubspot.jackson.jaxrs

Examples of com.hubspot.jackson.jaxrs.PropertyFilter


  public void writeTo(final Object o, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType,
      final MultivaluedMap<String, Object> httpHeaders, final OutputStream os) throws IOException {

    final PropertyFiltering annotation = findPropertyFiltering(annotations);

    final PropertyFilter propertyFilter = new PropertyFilter(uriInfo.getQueryParameters().get(annotation.using()));

    if (!propertyFilter.hasFilters()) {
      super.writeTo(o, type, genericType, annotations, mediaType, httpHeaders, os);
      return;
    }

    final Timer timer = getTimer();
    final Timer.Context context = timer.time();

    try {
      final JsonNode tree = objectMapper.valueToTree(o);
      propertyFilter.filter(tree);
      super.writeTo(tree, tree.getClass(), tree.getClass(), annotations, mediaType, httpHeaders, os);
    } finally {
      context.stop();
    }
  }
View Full Code Here

TOP

Related Classes of com.hubspot.jackson.jaxrs.PropertyFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.