(LoadContext context, CDOMObject obj, String value)
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public ParseResult parseToken(LoadContext context, CDOMObject obj, String value) |
| 61 | { |
| 62 | if (obj instanceof Ungranted) |
| 63 | { |
| 64 | return new ParseResult.Fail( |
| 65 | "Cannot use " + getTokenName() + " on an Ungranted object type: " + obj.getClass().getSimpleName()); |
| 66 | } |
| 67 | if (value.contains("PREAPPLY:")) |
| 68 | { |
| 69 | return new ParseResult.Fail( |
| 70 | "Use of PREAPPLY prohibited on a BONUS , " + "please use TEMPBONUS with: " + value); |
| 71 | } |
| 72 | final String v = value.replaceAll(Pattern.quote("<this>"), obj.getKeyName()); |
| 73 | BonusObj bon = Bonus.newBonus(context, v); |
| 74 | if (bon == null) |
| 75 | { |
| 76 | return new ParseResult.Fail(getTokenName() + " was given invalid bonus: " + value); |
| 77 | } |
| 78 | bon.setTokenSource(getTokenName()); |
| 79 | context.getObjectContext().addToList(obj, ListKey.BONUS, bon); |
| 80 | return ParseResult.SUCCESS; |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public String[] unparse(LoadContext context, CDOMObject obj) |
nothing calls this directly
no test coverage detected