Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate enum with input class object is not work #947

Closed
ldautova opened this issue Dec 18, 2018 · 1 comment
Closed

Generate enum with input class object is not work #947

ldautova opened this issue Dec 18, 2018 · 1 comment

Comments

@ldautova
Copy link

ldautova commented Dec 18, 2018

Hello!
I have some json scheme with object

{
"myEnum": {
	"type": "object",
	"properties": {
		"code": {
			"type": "integer"
		},
		"name": {
			"type": "string"
		}
	},
	"enum": [
		{
			"code": 1,
			"name": "Example 1"
		}
	],
	"javaEnumNames": [
		"EXAMPLE_1"
	]
}
}

I want to generate similar structure

  public class MainClass {
        private MyEnum myEnum;
    }

    public enum MyEnum {
        sub1(new Subitem(1, "asd")),
        sub2(new Subitem(2, "asd1"));

        private Subitem subitem;
        MyEnum(Subitem asd1) {
            this.subitem = asd1;
        }

        public Subitem getSubitem() {
            return subitem;
        }

        public void setSubitem(Subitem subitem) {
            this.subitem = subitem;
        }
    }

    public static class Subitem {
        private Integer code;
        private String name;

        public Subitem(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

How can i do this? That now, after generation a have a class without object ("code": 1, "name": "Example 1")

    public enum MyEnum {
        sub1(null),
        sub2(null);
   }
@joelittlejohn
Copy link
Owner

Not supported I'm afraid, but discussed in #1181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants