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

Method unparse

code/src/java/plugin/lsttokens/variable/GlobalToken.java:93–123  ·  view source on GitHub ↗
(LoadContext context, DatasetVariable dv)

Source from the content-addressed store, hash-verified

91 }
92
93 @Override
94 public String[] unparse(LoadContext context, DatasetVariable dv)
95 {
96 PCGenScope scope = dv.getScope();
97 if (scope != null && !scope.getName().equals(GlobalPCScope.GLOBAL_SCOPE_NAME))
98 {
99 //is a local variable
100 return null;
101 }
102 FormatManager<?> format = dv.getFormat();
103 if (format == null)
104 {
105 //Not a valid object
106 return null;
107 }
108 String varName = dv.getKeyName();
109 if (!DatasetVariable.isLegalName(varName))
110 {
111 //internal variable
112 return null;
113 }
114 StringBuilder sb = new StringBuilder();
115 String identifier = format.getIdentifierType();
116 if (!"NUMBER".equals(identifier))
117 {
118 sb.append(format.getIdentifierType());
119 sb.append('=');
120 }
121 sb.append(varName);
122 return new String[]{sb.toString()};
123 }
124
125 @Override
126 public Class<DatasetVariable> getTokenClass()

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected