We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm currrently transitioning from SimpleXML to TikXML, but there seems to be no way to create enums from markup. Given a markup like this:
<user> <name>Jane Doe</name> <permissions> <permission>read</permission> <permission>write</permission> <permission>delete</permission> </permissions> </user>
And classes like these:
@Xml class User { @Element(name="name") String name; @Path("permissions") @Element(name="permission") List<Permission> permissions; } enum Permission { case READ("read") case WRITE("write") case DELETE("delete") private String name; Permission(String name) { this.name = name; } String getName() { return name; }
In SimpleXML, I was able to write a Converter like this:
class PermissionConverter implements TypeConverter<Permission> { public Permission read(String val) throws Exception { for (Permission p: Permission.values()) { if (p.getName().equals(val)) { return p; } } throw IllegalArgumentException("No case for " + p); } public String write(Permission p) { return p.getName(); } }
Are there any technical or performance problems with this approach? Thanks in advance!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm currrently transitioning from SimpleXML to TikXML, but there seems to be no way to create enums from markup. Given a markup like this:
And classes like these:
In SimpleXML, I was able to write a Converter like this:
Are there any technical or performance problems with this approach? Thanks in advance!
The text was updated successfully, but these errors were encountered: