Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class 1:
- public class Class1 implements ConfigurationSerializable {
- Class2 attribute;
- @Override
- public Map<String, Object> serialize() {
- Map<String, Object> result = new LinkedHashMap<>();
- result.put("atr",attribute);
- args.get("atr");//this is not null
- return result;
- }
- public static Class1 deserialize(Map<String, Object> args) {
- Class1 result = new Class1();
- args.get("atr"); //this is null
- result.attribute = (Class2) args.get("atr");
- return result;
- }
- }
- Class 2:
- public class Class2 implements ConfigurationSerializable {
- String one,two,three;
- @Override
- public Map<String, Object> serialize() {
- Map<String, Object> result = new LinkedHashMap<>();
- result.put("one",one);
- result.put("two",two);
- result.put("three",three);
- return result;
- }
- public static Class2 deserialize(Map<String, Object> args) {
- Class2 result = new Class2();
- result.one = (String) args.get("one");
- result.two = (String) args.get("two");
- result.three = (String) args.get("three");
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement