Package org.codehaus.jackson.map.ser

Examples of org.codehaus.jackson.map.ser.FilterProvider


   
    // should also work for @JsonAnyGetter, as per [JACKSON-516]
    public void testAnyGetterFiltering() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        FilterProvider prov = new SimpleFilterProvider().addFilter("anyFilter",
                SimpleBeanPropertyFilter.filterOutAllExcept("b"));
        assertEquals("{\"a\":\"1\"}", mapper.writer(prov).writeValueAsString(new AnyBean()));
    }
View Full Code Here


  JsonGenerationException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
    mapper.configure(SerializationConfig.Feature.USE_ANNOTATIONS, true);
    if (ignoreConfigs) {
    FilterProvider filters = new SimpleFilterProvider().addFilter(
          "propertiesfilter",
          SimpleBeanPropertyFilter.serializeAllExcept("properties"));
      mapper.setFilters(filters);
    } else {
      FilterProvider filters = new SimpleFilterProvider().addFilter(
          "propertiesfilter", SimpleBeanPropertyFilter.serializeAllExcept());
      mapper.setFilters(filters);
    }
    String json = mapper.writeValueAsString(object);
    return json;
View Full Code Here

    @Override
    public <T> String serializeAllExceptFilter(Object src,
            Class<T> filterClass, Boolean refreshFilter, String... filterAttr)
            throws Exception {
        setCustomIntrospectorWithExternalFilterId(filterClass);
        FilterProvider filter = null;
        if ( filterClass != null) {
            if (filterAttr != null && filterAttr.length > 0 &&
                            !this.filters.containsKey(filterClass.getName())) {
                filter = new SimpleFilterProvider().addFilter(
                        filterClass.getName(),
View Full Code Here

   
    @Override
    public <T> String serializeOnlyFilter(Object src, Class<T> filterClass,
            Boolean refreshFilter, String... filterAttr) throws Exception {
        setCustomIntrospectorWithExternalFilterId(filterClass);
        FilterProvider filter = null;
        if (filterClass == null && src != null && src.getClass() != null) {
            filterClass =(Class<T>) src.getClass();
        }
        if ( filterClass != null) {
            if (!this.filters.containsKey(filterClass.getName())) {
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.ser.FilterProvider

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.