当前位置: 首页>>代码示例>>Java>>正文


Java SimpleBeanPropertyFilter.filterOutAllExcept方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.filterOutAllExcept方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleBeanPropertyFilter.filterOutAllExcept方法的具体用法?Java SimpleBeanPropertyFilter.filterOutAllExcept怎么用?Java SimpleBeanPropertyFilter.filterOutAllExcept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter的用法示例。


在下文中一共展示了SimpleBeanPropertyFilter.filterOutAllExcept方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@Override
public PropertyFilter apply(FilterOutAllExcept annotation) {
  return SimpleBeanPropertyFilter.filterOutAllExcept(annotation.value());
}
 
开发者ID:shihyuho,项目名称:jackson-dynamic-filter,代码行数:5,代码来源:FilterOutAllExceptResolver.java

示例2: findPropertyFilter

import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public PropertyFilter findPropertyFilter(final Object filterId, final Object valueToFilter) {
    if (filterId instanceof String) {
        final String id = (String) filterId;

        // FilterId should represent a class only in case of root entity is marshalled.
        if (id.equals(root.getEntityClass().getName())) {
            stack.clear();
            return stack.push(root);
        }

        while (!stack.isEmpty()) {
            final FilteringPropertyFilter peek = stack.peek();
            final FilteringPropertyFilter subfilter = peek.findSubfilter(id);

            if (subfilter != null) {
                stack.push(subfilter);

                // Need special handling for maps here - map keys can be filtered as well so we just say that every key is
                // allowed.
                if (valueToFilter instanceof Map) {
                    final Map<String, ?> map = (Map<String, ?>) valueToFilter;
                    return new FilteringPropertyFilter(Map.class, map.keySet(),
                            Collections.emptyMap());
                }
                return subfilter;
            } else {
                stack.pop();
            }
        }
    }
    return SimpleBeanPropertyFilter.filterOutAllExcept();
}
 
开发者ID:icode,项目名称:ameba,代码行数:35,代码来源:JacksonObjectProvider.java

示例3: include

import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
/**
 * 包含指定的属性
 */
public Jacksons include(Class<?> dataType, String... properties) {
	SimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept(properties);
	return definePropertyFilter(dataType, filter);
   }
 
开发者ID:easycodebox,项目名称:easycode,代码行数:8,代码来源:Jacksons.java

示例4: retrieveSomeBean

import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@GetMapping("/filtering")
public MappingJacksonValue retrieveSomeBean() {
	SomeBean someBean = new SomeBean("value1", "value2", "value3");

	SimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept("field1", "field2");

	FilterProvider filters = new SimpleFilterProvider().addFilter("SomeBeanFilter", filter);

	MappingJacksonValue mapping = new MappingJacksonValue(someBean);

	mapping.setFilters(filters);

	return mapping;
}
 
开发者ID:in28minutes,项目名称:spring-web-services,代码行数:15,代码来源:FilteringController.java

示例5: retrieveListOfSomeBeans

import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@GetMapping("/filtering-list")
public MappingJacksonValue retrieveListOfSomeBeans() {
	List<SomeBean> list = Arrays.asList(new SomeBean("value1", "value2", "value3"),
			new SomeBean("value12", "value22", "value32"));

	SimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept("field2", "field3");

	FilterProvider filters = new SimpleFilterProvider().addFilter("SomeBeanFilter", filter);

	MappingJacksonValue mapping = new MappingJacksonValue(list);

	mapping.setFilters(filters);

	return mapping;
}
 
开发者ID:in28minutes,项目名称:spring-web-services,代码行数:16,代码来源:FilteringController.java


注:本文中的com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.filterOutAllExcept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。