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

Method processToken

code/src/java/pcgen/persistence/lst/LstUtils.java:118–149  ·  view source on GitHub ↗
(LoadContext context, Loadable po, Object source, String tok)

Source from the content-addressed store, hash-verified

116 }
117
118 public static boolean processToken(LoadContext context, Loadable po, Object source, String tok)
119 {
120 final String token = tok.trim();
121 final int colonLoc = token.indexOf(':');
122 if (colonLoc == -1)
123 {
124 Logging.errorPrint("Invalid Token - does not contain a colon: '" + token + "' in "
125 + po.getClass().getSimpleName() + " " + po.getDisplayName() + " of " + source);
126 return false;
127 }
128 else if (colonLoc == 0)
129 {
130 Logging.errorPrint("Invalid Token - starts with a colon: '" + token + "' in "
131 + po.getClass().getSimpleName() + " " + po.getDisplayName() + " of " + source);
132 return false;
133 }
134
135 String key = token.substring(0, colonLoc);
136 String value = (colonLoc == (token.length() - 1)) ? null : token.substring(colonLoc + 1);
137 boolean successful = context.processToken(po, key, value);
138 if (successful)
139 {
140 context.commit();
141 }
142 else
143 {
144 context.rollback();
145 Logging.replayParsedMessages();
146 }
147 Logging.clearParseMessages();
148 return successful;
149 }
150}

Callers 10

parseLineMethod · 0.95
parseLineMethod · 0.95
parseLineMethod · 0.95
parseLineMethod · 0.95
processNonFirstTokenMethod · 0.95
parseLineMethod · 0.95
parseLineMethod · 0.95
parseLineMethod · 0.95
parseLineMethod · 0.95
getLoadableMethod · 0.95

Calls 10

errorPrintMethod · 0.95
replayParsedMessagesMethod · 0.95
clearParseMessagesMethod · 0.95
trimMethod · 0.80
getSimpleNameMethod · 0.80
indexOfMethod · 0.65
getDisplayNameMethod · 0.65
processTokenMethod · 0.65
commitMethod · 0.65
rollbackMethod · 0.65

Tested by

no test coverage detected