I would like to set an enum type by using one of its values as an input :
This is the code i’m using,
package models;
import models.crudsiena.SienaSupport;
import siena.*;
public class Item extends SienaSupport {
@Id
public Long id;
public static enum Type{
A,
B
};
public Type itemType;
public Item(String itemType) {
this.itemType = Type.valueOf(itemType);
}
}
When I try to use new Item("A") it returns me a NullPointerException occured : Name is null
Try this: