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

Method process

code/src/java/plugin/lsttokens/BonusLst.java:124–175  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj)

Source from the content-addressed store, hash-verified

122 }
123
124 @Override
125 public boolean process(LoadContext context, CDOMObject obj)
126 {
127 List<BonusObj> bonusList = obj.getListFor(ListKey.BONUS);
128 boolean returnValue = true;
129 if (bonusList != null)
130 {
131 for (BonusObj bonus : bonusList)
132 {
133 String bonusName = bonus.getBonusName();
134 if ("ABILITYPOOL".equalsIgnoreCase(bonusName))
135 {
136 for (Object o : bonus.getBonusInfoList())
137 {
138 if (context.getReferenceContext().silentlyGetConstructedCDOMObject(ABILITY_CATEGORY_CLASS,
139 o.toString()) == null)
140 {
141 LoadContext dummyCtx = new RuntimeLoadContext(context.getReferenceContext(),
142 new ConsolidatedListCommitStrategy());
143 dummyCtx.setSourceURI(obj.getSourceURI());
144 Logging.errorPrint("BONUS: " + bonus + " in " + obj.getClass().getSimpleName() + ' '
145 + obj.getKeyName() + " contained an invalid AbilityCategory " + o.toString(), dummyCtx);
146 returnValue = false;
147 }
148 }
149 }
150 else if ("UDAM".equals(bonusName))
151 {
152 for (Object o : bonus.getBonusInfoList())
153 {
154 String classKey = o.toString();
155 final PCClass aClass =
156 context.getReferenceContext().silentlyGetConstructedCDOMObject(PCCLASS_CLASS, classKey);
157 if (aClass == null)
158 {
159 Logging.errorPrint("Could not find class '" + classKey + "' for UDAM token", context);
160 }
161 }
162 }
163 }
164 }
165 try
166 {
167 obj.ownBonuses(obj);
168 }
169 catch (CloneNotSupportedException e)
170 {
171 Logging.errorPrint(e.getLocalizedMessage());
172 return false;
173 }
174 return returnValue;
175 }
176
177 @Override
178 public Class<CDOMObject> getDeferredTokenClass()

Callers

nothing calls this directly

Calls 14

errorPrintMethod · 0.95
equalsIgnoreCaseMethod · 0.80
getBonusInfoListMethod · 0.80
getSimpleNameMethod · 0.80
getListForMethod · 0.65
getReferenceContextMethod · 0.65
toStringMethod · 0.65
setSourceURIMethod · 0.65
getSourceURIMethod · 0.65
getKeyNameMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected