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

Method parseToken

code/src/java/plugin/lsttokens/SrLst.java:43–65  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj, String value)

Source from the content-addressed store, hash-verified

41 }
42
43 @Override
44 public ParseResult parseToken(LoadContext context, CDOMObject obj, String value)
45 {
46 if (obj instanceof Ungranted)
47 {
48 return new ParseResult.Fail(
49 "Cannot use " + getTokenName() + " on an Ungranted object type: " + obj.getClass().getSimpleName());
50 }
51 if (Constants.LST_DOT_CLEAR.equals(value))
52 {
53 context.getObjectContext().remove(obj, ObjectKey.SR);
54 }
55 else
56 {
57 Formula formula = FormulaFactory.getFormulaFor(value);
58 if (!formula.isValid())
59 {
60 return new ParseResult.Fail("Formula in " + getTokenName() + " was not valid: " + formula.toString());
61 }
62 context.getObjectContext().put(obj, ObjectKey.SR, new SpellResistance(formula));
63 }
64 return ParseResult.SUCCESS;
65 }
66
67 @Override
68 public String[] unparse(LoadContext context, CDOMObject obj)

Callers

nothing calls this directly

Calls 9

getTokenNameMethod · 0.95
getFormulaForMethod · 0.95
isValidMethod · 0.95
getSimpleNameMethod · 0.80
equalsMethod · 0.65
removeMethod · 0.65
getObjectContextMethod · 0.65
toStringMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected