MCPcopy Create free account
hub / github.com/PCGen/pcgen / VarHolderSupport

Class VarHolderSupport

code/src/java/pcgen/cdom/helper/VarHolderSupport.java:31–105  ·  view source on GitHub ↗

VarHolderSupport implements a standard implementation of the VarHolder interface. This allows this behavior to be shared through delegation to this support object.

Source from the content-addressed store, hash-verified

29 * allows this behavior to be shared through delegation to this support object.
30 */
31public class VarHolderSupport implements VarHolder, VarContainer
32{
33 /**
34 * The list of VarModifier objects in this VarHolderSupport.
35 *
36 * Lazily instantiated.
37 */
38 private List<VarModifier<?>> modifierList;
39
40 /**
41 * The list of RemoteModifier objects in this VarHolderSupport.
42 *
43 * Lazily instantiated.
44 */
45 private List<RemoteModifier<?>> remoteModifierList;
46
47 /**
48 * The list of granted variables in this VarHolderSupport.
49 *
50 * Lazily instantiated.
51 */
52 private List<String> grantedVars;
53
54 @Override
55 public void addModifier(VarModifier<?> vm)
56 {
57 if (modifierList == null)
58 {
59 modifierList = new ArrayList<>();
60 }
61 modifierList.add(vm);
62 }
63
64 @Override
65 public VarModifier<?>[] getModifierArray()
66 {
67 return (modifierList == null) ? VarModifier.EMPTY_VARMODIFIER
68 : modifierList.toArray(new VarModifier[0]);
69 }
70
71 @Override
72 public void addRemoteModifier(RemoteModifier<?> vm)
73 {
74 if (remoteModifierList == null)
75 {
76 remoteModifierList = new ArrayList<>();
77 }
78 remoteModifierList.add(vm);
79 }
80
81 @Override
82 public RemoteModifier<?>[] getRemoteModifierArray()
83 {
84 return (remoteModifierList == null) ? RemoteModifier.EMPTY_REMOTEMODIFIER
85 : remoteModifierList.toArray(new RemoteModifier[0]);
86 }
87
88 @Override

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected