Extracting name and value from the enum I wrote the below enum from which I need to extract the name and its value:

public enum UserEnum {
    TreeUser("/tree"), ParentUser("/parent");

    private String value;

    UserEnum(String value) {
        this.value = value;
    }

    public String value() {
        return value;
    }
}


This is the way I am using the above UserEnum in my code base:

// extract TreeUser
String nameOfTree = UserEnum.TreeUser.name();
String valueOfTree = UserEnum.TreeUser.value();

// extract ParentUser   
String nameOfParent = UserEnum.ParentUser.name();
String valueOfParent = UserEnum.ParentUser.value(); 

// and I am using UserEnum this way as well to make name1=value1,name2=value2   
String mapping = UserEnum.TreeUser.name() + "="
                + UserEnum.TreeUser.value() + "," + UserEnum.ParentUser.name() + "="
                + UserEnum.ParentUser.value();  


I am opting for a review to see whether I can simplify anything in my enum.
Not sure about the usage of nameOfTree , nameOfParent and same for the value. But one thing to simplify your mapping and provide a representation for your enum is:

public String toString(){
    return  this.name() + "=" + this.value()
}

// and mapping cna be written as.
String mapping = UserEnum.TreeUser.toString() +  "," + UserEnum.ParentUser.toString();
String mapping = UserEnum.TreeUser +  "," + UserEnum.ParentUser; // toString() is called implictly.