Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import javax.xml.bind.annotation.XmlEnumValue;

public class Main {
    /** Read the {@link XmlEnumValue} string off of an enum. */
    public static String enumToXml(Enum<?> input) {
        try {
            return input.getClass().getField(input.name()).getAnnotation(XmlEnumValue.class).value();
        } catch (NoSuchFieldException e) {
            throw new RuntimeException(e);
        }
    }
}