diff --git a/pom.xml b/pom.xml
index 5e54f64..d730dc0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.alterdekim.game
actionScriptDecompiler
- 0.0.6
+ 0.0.7
jar
SWFDissect
diff --git a/src/main/java/com/alterdekim/flash/decompiler/mapper/FlashMapper.java b/src/main/java/com/alterdekim/flash/decompiler/mapper/FlashMapper.java
index ee925b2..c9850f8 100644
--- a/src/main/java/com/alterdekim/flash/decompiler/mapper/FlashMapper.java
+++ b/src/main/java/com/alterdekim/flash/decompiler/mapper/FlashMapper.java
@@ -7,14 +7,45 @@ import org.apache.commons.lang3.tuple.Pair;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
+import java.util.stream.Collectors;
@Slf4j
public class FlashMapper {
+ public static Map objToMap(List l) {
+ Map m = new HashMap<>();
+ for( T o : l ) {
+ try {
+ Map m1 = new HashMap<>();
+ String s = getId(o).toString();
+ List fields = Arrays.stream(o.getClass().getDeclaredFields())
+ .filter(f -> f.isAnnotationPresent(FlashField.class))
+ .collect(Collectors.toList());
+ for (Field f : fields) {
+ String key = f.getAnnotation(FlashField.class).name();
+ Object val = f.get(o);
+ m1.put(key, val);
+ }
+ m.put(s, m1);
+ } catch (IllegalAccessException e) {
+ log.error("FlashMapper valueGet error: {}", e.getMessage());
+ }
+ }
+ return m;
+ }
+
+ private static Long getId(T o) throws IllegalAccessException {
+ Optional idField = Arrays.stream(o.getClass().getDeclaredFields())
+ .filter(f -> f.isAnnotationPresent(FlashValue.class) &&
+ f.getAnnotation(FlashValue.class).type() == FlashValueType.Id)
+ .findFirst();
+ if( idField.isEmpty() ) return 0L;
+ Field f = idField.get();
+ f.setAccessible(true);
+ return (Long) f.get(o);
+ }
+
public static T mapToObj(Map m, Class obj) {
try {
T result = obj.getDeclaredConstructor().newInstance();