Skip to content

Commit

Permalink
CoreUtilities.objectToList
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 13, 2021
1 parent 6f6676c commit 21240c5
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -820,4 +820,22 @@ public static String journallingLoadFile(String filePath) {
return null;
}
}

public static Collection<ObjectTag> objectToList(ObjectTag list, TagContext context) {
if (list instanceof MapTag) {
return ((MapTag) list).map.values();
}
else if (list instanceof ListTag) {
return ((ListTag) list).objectForms;
}
else {
String raw = list.toString();
if (raw.startsWith("map@") || raw.startsWith("[")) {
return MapTag.valueOf(raw, context).map.values();
}
else {
return ListTag.valueOf(raw, context).objectForms;
}
}
}
}

0 comments on commit 21240c5

Please sign in to comment.