Package com.fasterxml.jackson.databind.ser.impl

Examples of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider


    private <T> void removeFilter(Class<T> filterClass) {
        if (filterClass == null)
            return;
        if (this.filters.containsKey(filterClass.getName())) {
            removeCustomIntrospectorWithExternalFilterId(filterClass);
            SimpleFilterProvider smpfilter = (SimpleFilterProvider) this.filters
                    .get(filterClass.getName());
            smpfilter.removeFilter(filterClass.getName());
            this.filters.remove(filterClass.getName());
            cleanSerializerCache();
            getLogger().debug(
                    "removed from  SimpleFilterProvider filters "
                            + filterClass.getName());
View Full Code Here


        mapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE);
        mapper.setVisibility(PropertyAccessor.CREATOR, Visibility.NONE);
       
        mapper.addMixInAnnotations(Object.class, IgnoreTypeMixIn.class);
       
        final FilterProvider filters = new SimpleFilterProvider().addFilter("storedDataFilter", SimpleBeanPropertyFilter.serializeAllExcept("storedData"));

        final ObjectWriter ssWriter = mapper.writer(filters);
        final ObjectReader ssReader = mapper.reader(sus.getClass());
       
        final String susString = ssWriter.writeValueAsString(sus);
View Full Code Here

    public void testMixinNoCopy() throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        mapper.findAndRegisterModules();
       
        mapper.addMixInAnnotations(Object.class, PortletRenderExecutionEventFilterMixIn.class);
        final FilterProvider filterProvider = new SimpleFilterProvider().addFilter(PortletRenderExecutionEventFilterMixIn.FILTER_NAME, SimpleBeanPropertyFilter.filterOutAllExcept("fname", "executionTimeNano", "parameters"));
        final ObjectWriter portletEventWriter = mapper.writer(filterProvider);
       
        final String result = portletEventWriter.writeValueAsString(createEvent());
       
        assertEquals("{\"@c\":\".PortletRenderExecutionEvent\",\"fname\":\"fname1\",\"executionTimeNano\":123450000,\"parameters\":{}}", result);
View Full Code Here

       
        //Clone from "shared" ObjectMapper
        mapper = mapper.copy();
       
        mapper.addMixInAnnotations(Object.class, PortletRenderExecutionEventFilterMixIn.class);
        final FilterProvider filterProvider = new SimpleFilterProvider().addFilter(PortletRenderExecutionEventFilterMixIn.FILTER_NAME, SimpleBeanPropertyFilter.filterOutAllExcept("fname", "executionTimeNano", "parameters"));
        final ObjectWriter portletEventWriter = mapper.writer(filterProvider);
       
        final String result = portletEventWriter.writeValueAsString(createEvent());
       
        assertEquals("{\"@c\":\".PortletRenderExecutionEvent\",\"fname\":\"fname1\",\"executionTimeNano\":123450000,\"parameters\":{}}", result);
View Full Code Here

     * those that are actually needed for the analytics reporting
     */
    private void initMapper() {
        final BeanPropertyFilter filterOutAllExcept = SimpleBeanPropertyFilter.filterOutAllExcept("fname", "executionTimeNano");
        this.mapper.addMixInAnnotations(PortalEvent.class, PortletRenderExecutionEventFilterMixIn.class);
        final SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.addFilter(PortletRenderExecutionEventFilterMixIn.FILTER_NAME, filterOutAllExcept);
        this.portletEventWriter = this.mapper.writer(filterProvider);
    }
View Full Code Here

        mapper.setVisibility(PropertyAccessor.IS_GETTER, Visibility.NONE);
        mapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE);
        mapper.setVisibility(PropertyAccessor.CREATOR, Visibility.NONE);
       
        //Ignore the empty storedData field in all of the stat summary objects
        filters = new SimpleFilterProvider().addFilter(StoredDataFilterMixIn.FILTER_NAME, SimpleBeanPropertyFilter.serializeAllExcept("storedData"));
        mapper.addMixInAnnotations(Object.class, StoredDataFilterMixIn.class);
    }
View Full Code Here

        mapper = new ObjectMapper();

        // When serializing entity JSON for events, we want to use a reduced number
        // of fields nested objects, so enable the event and API HATEOAS filters:
        SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.setFailOnUnknownId(false);
        filterProvider = filterProvider.addFilter("PoolFilter",
            new PoolEventFilter());
        filterProvider = filterProvider.addFilter("ConsumerFilter",
            new HateoasBeanPropertyFilter());
        filterProvider = filterProvider.addFilter("EntitlementFilter",
            new HateoasBeanPropertyFilter());
        filterProvider = filterProvider.addFilter("OwnerFilter",
            new HateoasBeanPropertyFilter());
        filterProvider = filterProvider.addFilter("IdentityCertificateFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
        filterProvider = filterProvider.addFilter("EntitlementCertificateFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
        filterProvider = filterProvider.addFilter("PoolAttributeFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "id"));
        filterProvider = filterProvider.addFilter("ProductPoolAttributeFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "productId", "id"));
        filterProvider = filterProvider.addFilter("SubscriptionCertificateFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("cert", "key"));
        mapper.setFilters(filterProvider);

        Hibernate4Module hbm = new Hibernate4Module();
        hbm.enable(Hibernate4Module.Feature.FORCE_LAZY_LOADING);
View Full Code Here

    private ObjectMapper mapper;

    private RulesObjectMapper() {
        this.mapper = new ObjectMapper();

        SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.setFailOnUnknownId(false);
        filterProvider = filterProvider.addFilter("PoolAttributeFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "id"));
        filterProvider = filterProvider.addFilter("ProductPoolAttributeFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("created", "updated", "productId",
                "id"));
        filterProvider = filterProvider.addFilter("ProvidedProductFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("created", "updated"));
        filterProvider = filterProvider.addFilter("ConsumerFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("idCert"));
        filterProvider = filterProvider.addFilter("EntitlementFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("certificates", "consumer"));
        filterProvider = filterProvider.addFilter("OwnerFilter",
            SimpleBeanPropertyFilter.serializeAllExcept("parentOwner", "consumers",
                "activationKeys", "environments", "pools"));
        this.mapper.setFilters(filterProvider);

        Hibernate4Module hbm = new Hibernate4Module();
View Full Code Here

        if (indentJson) {
            mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        }

        SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.setDefaultFilter(new DynamicPropertyFilter());
        filterProvider.setFailOnUnknownId(false);
        mapper.setFilters(filterProvider);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary =
            new JaxbAnnotationIntrospector(mapper.getTypeFactory());
View Full Code Here

        if (indentJson) {
            mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        }

        SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider = filterProvider.addFilter("ConsumerFilter",
            new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
        filterProvider = filterProvider.addFilter("EntitlementFilter",
            new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
        filterProvider = filterProvider.addFilter("OwnerFilter",
            new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
        filterProvider = filterProvider.addFilter("GuestFilter",
            new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
        filterProvider.setDefaultFilter(new DynamicPropertyFilter());
        filterProvider.setFailOnUnknownId(false);
        mapper.setFilters(filterProvider);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary =
            new JaxbAnnotationIntrospector(mapper.getTypeFactory());
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider

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.