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

Method unparse

code/src/java/plugin/lsttokens/GrantLst.java:92–116  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj)

Source from the content-addressed store, hash-verified

90 }
91
92 @Override
93 public String[] unparse(LoadContext context, CDOMObject obj)
94 {
95 Changes<CDOMReference<Dynamic>> changes = context.getObjectContext().getListChanges(obj, ListKey.GRANTED);
96 HashMapToList<String, String> map = new HashMapToList<>();
97 Collection<CDOMReference<Dynamic>> added = changes.getAdded();
98 if (added != null && !added.isEmpty())
99 {
100 for (CDOMReference<Dynamic> ref : added)
101 {
102 map.addToListFor(ref.getPersistentFormat(), ref.getLSTformat(false));
103 }
104 }
105 if (map.isEmpty())
106 {
107 return null;
108 }
109 Set<String> set = new TreeSet<>();
110 for (String scope : map.getKeySet())
111 {
112 List<String> scopeList = map.getListFor(scope);
113 set.add(scope + Constants.PIPE + StringUtils.join(scopeList, Constants.PIPE));
114 }
115 return set.toArray(new String[0]);
116 }
117
118 @Override
119 public Class<CDOMObject> getTokenClass()

Callers

nothing calls this directly

Calls 12

joinMethod · 0.80
getListChangesMethod · 0.65
getObjectContextMethod · 0.65
getAddedMethod · 0.65
isEmptyMethod · 0.65
addToListForMethod · 0.65
getPersistentFormatMethod · 0.65
getLSTformatMethod · 0.65
getKeySetMethod · 0.65
getListForMethod · 0.65
addMethod · 0.65
toArrayMethod · 0.45

Tested by

no test coverage detected