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

Class EquipmentToken

code/src/java/plugin/lsttokens/choose/EquipmentToken.java:30–77  ·  view source on GitHub ↗

New chooser plugin, handles Equipment.

Source from the content-addressed store, hash-verified

28 * New chooser plugin, handles Equipment.
29 */
30public class EquipmentToken extends AbstractQualifiedChooseToken<Equipment>
31{
32
33 private static final Class<Equipment> EQUIPMENT_CLASS = Equipment.class;
34
35 @Override
36 public String getTokenName()
37 {
38 return "EQUIPMENT";
39 }
40
41 @Override
42 protected String getDefaultTitle()
43 {
44 return "Equipment choice";
45 }
46
47 @Override
48 public Equipment decodeChoice(LoadContext context, String s)
49 {
50 return context.getReferenceContext().silentlyGetConstructedCDOMObject(EQUIPMENT_CLASS, s);
51 }
52
53 @Override
54 public String encodeChoice(Equipment choice)
55 {
56 return choice.getKeyName();
57 }
58
59 @Override
60 protected AssociationListKey<Equipment> getListKey()
61 {
62 return AssociationListKey.getKeyFor(EQUIPMENT_CLASS, "CHOOSE*EQUIPMENT");
63 }
64
65 @Override
66 protected ParseResult parseTokenWithSeparator(LoadContext context, CDOMObject obj, String value)
67 {
68 return super.parseTokenWithSeparator(context, context.getReferenceContext().getManufacturer(EQUIPMENT_CLASS),
69 obj, value);
70 }
71
72 @Override
73 protected String getPersistentFormat()
74 {
75 return "EQUIPMENT";
76 }
77}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected