1 package org.pojomatic.internal;
2
3 import java.util.Collections;
4 import java.util.Set;
5
6 import org.pojomatic.annotations.DefaultPojomaticPolicy;
7 import org.pojomatic.annotations.PojomaticPolicy;
8
9 public class PropertyFilter {
10 private PropertyFilter() {}
11
12
13
14
15
16
17
18
19
20 public static Set<PropertyRole> getRoles(
21 PojomaticPolicy elementPolicy, DefaultPojomaticPolicy classPolicy) {
22 if (elementPolicy != null) {
23 Set<PropertyRole> roles = elementPolicy.getRoles();
24 if (roles == null) {
25 return classPolicy != null ? classPolicy.getRoles() : PojomaticPolicy.ALL.getRoles();
26 }
27 else {
28 return roles;
29 }
30 }
31 else if(classPolicy != null) {
32 return classPolicy.getRoles();
33 }
34 else {
35 return Collections.emptySet();
36 }
37 }
38 }