Package com.google.gson

Examples of com.google.gson.ExclusionStrategy


  }

  @Inject
  public VRaptorGsonBuilder(@Any Instance<JsonSerializer<?>> serializers) {
    this.serializers = serializers;
    ExclusionStrategy exclusion = new Exclusions(serializee);
    exclusions = singletonList(exclusion);
  }
View Full Code Here


            {
                String autocompleteField = (String) facets.toArray()[0];
                fResults = qResults
                        .getFacetResult(autocompleteField);               
            }
            Gson gson = new GsonBuilder().addSerializationExclusionStrategy(new ExclusionStrategy() {
       
        @Override
        public boolean shouldSkipField(FieldAttributes f) {
         
          if(f.getName().equals("asFilterQuery"))return true;
View Full Code Here

 
  @Inject
  public GsonBuilderWrapper(@Any Instance<JsonSerializer<?>> jsonSerializers, @Any Instance<JsonDeserializer<?>> jsonDeserializers) {
    this.jsonSerializers = jsonSerializers;
    this.jsonDeserializers = jsonDeserializers;
    ExclusionStrategy exclusion = new Exclusions(serializee);
    exclusions = singletonList(exclusion);
  }
View Full Code Here

     * @param prettyPrint
     * @return
     */
    public String toJsonAndSkipCertainFields(Object obj, final List<String> excludedFields,
            boolean prettyPrint) {
        ExclusionStrategy strategy = new ExclusionStrategy() {
            public boolean shouldSkipField(FieldAttributes f) {
                if (excludedFields.contains(f.getName())) {
                    return true;
                }

View Full Code Here

     * @param prettyPrint
     * @return
     */
    public String toJsonAndSkipCertainFields(Object obj, final List<String> excludedFields,
            boolean prettyPrint) {
        ExclusionStrategy strategy = new ExclusionStrategy() {
            public boolean shouldSkipField(FieldAttributes f) {
                if (excludedFields.contains(f.getName())) {
                    return true;
                }

View Full Code Here

  }

  @Inject
  public VRaptorGsonBuilder(@Any Instance<JsonSerializer<?>> serializers) {
    this.serializers = serializers;
    ExclusionStrategy exclusion = new Exclusions(serializee);
    exclusions = singletonList(exclusion);
  }
View Full Code Here

  }

  @Inject
  public VRaptorGsonBuilder(@Any Instance<JsonSerializer<?>> serializers) {
    this.serializers = serializers;
    ExclusionStrategy exclusion = new Exclusions(serializee);
    exclusions = singletonList(exclusion);
  }
View Full Code Here

        return builder.create();
    }

    public Gson createGsonBuilderForPartialResponseFiltering(final boolean prettyPrint, final Set<String> responseParameters) {

        final ExclusionStrategy strategy = new ParameterListInclusionStrategy(responseParameters);

        final GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy);
        builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter());
        builder.registerTypeAdapter(DateTime.class, new JodaDateTimeAdapter());
        builder.registerTypeAdapter(MonthDay.class, new JodaMonthDayAdapter());
View Full Code Here

            parameterNamesToSkip.addAll(supportedParameters);
            parameterNamesToSkip.removeAll(responseParameters);
        }

        final ExclusionStrategy strategy = new ParameterListExclusionStrategy(parameterNamesToSkip);

        final GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy);
        builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter());
        builder.registerTypeAdapter(DateTime.class, new JodaDateTimeAdapter());
        builder.registerTypeAdapter(MonthDay.class, new JodaMonthDayAdapter());
View Full Code Here

      @Any Instance<JsonDeserializer<?>> jsonDeserializers,
      Serializee serializee) {
    this.jsonSerializers = jsonSerializers;
    this.jsonDeserializers = jsonDeserializers;
    this.serializee = serializee;
    ExclusionStrategy exclusion = new Exclusions(serializee);
    exclusions = singletonList(exclusion);
  }
View Full Code Here

TOP

Related Classes of com.google.gson.ExclusionStrategy

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.