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

Method unparse

code/src/java/plugin/lsttokens/variable/LocalToken.java:118–150  ·  view source on GitHub ↗
(LoadContext context, DatasetVariable dv)

Source from the content-addressed store, hash-verified

116 }
117
118 @Override
119 public String[] unparse(LoadContext context, DatasetVariable dv)
120 {
121 PCGenScope scope = dv.getScope();
122 if (scope == null || scope.getName().equals(GlobalPCScope.GLOBAL_SCOPE_NAME))
123 {
124 //Global variable
125 return null;
126 }
127 FormatManager<?> format = dv.getFormat();
128 if (format == null)
129 {
130 //Not a valid object
131 return null;
132 }
133 String varName = dv.getKeyName();
134 if (!DatasetVariable.isLegalName(varName))
135 {
136 //internal variable
137 return null;
138 }
139 StringBuilder sb = new StringBuilder();
140 sb.append(LegalScope.getFullName(scope));
141 sb.append(Constants.PIPE);
142 String identifier = format.getIdentifierType();
143 if (!"NUMBER".equals(identifier))
144 {
145 sb.append(format.getIdentifierType());
146 sb.append('=');
147 }
148 sb.append(varName);
149 return new String[]{sb.toString()};
150 }
151
152 @Override
153 public Class<DatasetVariable> getTokenClass()

Callers

nothing calls this directly

Calls 10

isLegalNameMethod · 0.95
equalsMethod · 0.65
getNameMethod · 0.65
getFormatMethod · 0.65
getKeyNameMethod · 0.65
getIdentifierTypeMethod · 0.65
toStringMethod · 0.65
getScopeMethod · 0.45
appendMethod · 0.45
getFullNameMethod · 0.45

Tested by

no test coverage detected