getSerializedName()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 3
c 1
b 0
f 0
cc 1
rs 10
1
package es.webbeta.serializer.metadata;
2
3
import es.webbeta.serializer.type.FieldAccessType;
4
5
import java.util.Collections;
6
import java.util.List;
7
8
public class MetadataProperty implements es.webbeta.serializer.base.MetadataProperty {
0 ignored issues
show
Comprehensibility introduced by
Class or interface names should not shadow other classes or interfaces. In general, shadowing is a bad practice as it makes code harder to understand. Consider renaming this class.
Loading history...
9
10
    private String propertyName;
11
    protected FieldAccessType accessType;
12
    protected MetadataPropertyAccessor accessor;
13
    private String serializedName;
14
    private List<String> groups;
15
16
    MetadataProperty(String propertyName) {
17
        this.propertyName = propertyName;
18
    }
19
20
    @Override
21
    public String getPropertyName() {
22
        return propertyName;
23
    }
24
25
    @Override
26
    public Boolean hasAccessType() {
27
        return accessType != null;
28
    }
29
30
    @Override
31
    public FieldAccessType getAccessType() {
32
        return accessType;
33
    }
34
35
    @Override
36
    public void setAccessType(FieldAccessType accessType) {
37
        this.accessType = accessType;
38
    }
39
40
    @Override
41
    public MetadataPropertyAccessor getAccessor() {
42
        return accessor;
43
    }
44
45
    @Override
46
    public void setAccessor(MetadataPropertyAccessor accessor) {
47
        this.accessor = accessor;
48
    }
49
50
    @Override
51
    public Boolean hasSerializedName() {
52
        return serializedName != null;
53
    }
54
55
    @Override
56
    public String getSerializedName() {
57
        return serializedName;
58
    }
59
60
    @Override
61
    public void setSerializedName(String serializedName) {
62
        this.serializedName = serializedName;
63
    }
64
65
    @Override
66
    public Boolean hasGroups() {
67
        return groups.size() > 0;
0 ignored issues
show
Best Practice introduced by
Use isEmpty() to check if a collection is empty instead of checking its size, since it is optimized for this task.
Loading history...
68
    }
69
70
    @Override
71
    public Boolean appliesToGroups(List<String> wantedGroups) {
72
        return !Collections.disjoint(groups, wantedGroups);
73
    }
74
75
    @Override
76
    public List<String> getGroups() {
77
        return groups;
78
    }
79
80
    @Override
81
    public void setGroups(List<String> groups) {
82
        this.groups = groups;
83
    }
84
85
}
86