-
Notifications
You must be signed in to change notification settings - Fork 181
Created Enum types have private field "name" but no accessor #286
Comments
I'm curious as to why you need an accessor for the name, as it's equal to the enum value ? it's mostly equal to enum.name().toLowerCase(). (You may quite rightly tell me it's non of my business, but I'm curious). This said, tonight I'll see if I can show you how to make a plugin to generate the accessor. |
:-)
public enum PriceType {
NETLIST("net_list");
// ...
private String name;
PriceType(String name) {
this.name = name;
}
} If I want to serialize an element of this type with Jackson or something similar into JSON it will serialize So at the moment, as a work-around, I'm using reflection to force-access the information from that private field, but, to me, that seems unnecessarily complicated. I see these options:
Cheers, Christian |
I'd like to ditch the incacessible field, honestly. it was put there for reasons I don't remember now. The actual raml name doesn't look like it's necessary. (sorry for the delay, am currently working on builder/emitter for raml). |
In my opinion, the names should be the same as specified in the RAML, without removing the underscores. |
you really need to be able to access exactly the string taken from RAML, which in version 2.1.0 is the name-field. If it is the SomeEnum.name(), fine but anything else make it unusable for us. |
Hi, we're using
to create resources from our raml definition. Problem is: all created Enum types have a private field
name
containing the actual enum value from the raml file, but there's no accessor for it.The text was updated successfully, but these errors were encountered: