當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。