- //实现PropertyFilter中的apply方法
- publicclassComplexPropertyPreFilterimplementsPropertyFilter{
- privateMap<Class<?>,Set<String>>includeMap=newHashMap<Class<?>,Set<String>>();
- //@Override
- booleanapply(Objectsource,Stringname,Objectvalue){
- for(Entry<Class<?>,Set<String>>entry:includeMap.entrySet()){
- Class<?>class1=entry.getKey();
- if(source.getClass()==class1){
- Set<String>fields=entry.getValue();
- for(Stringfield:fields){
- if(field.equals(name)){
- returnfalse;
- }
- }
- true;
- publicComplexPropertyPreFilter(Map<Class<?>,Set<String>>includeMap){
- this.includeMap=includeMap;
- }
测试类:
copy