java.lang.Enum Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-js-jre Show documentation
Show all versions of dragome-js-jre Show documentation
Dragome SDK module: js-jre
package java.lang;
import com.dragome.commons.javascript.ScriptHelper;
/**
* This is the common base class of all Java language enumeration types.
*/
public abstract class Enum
{
private String desc;
private int ordinal;
/**
* Sole constructor.
*/
protected Enum(String theDesc, int theOrdinal)
{
desc= theDesc;
ordinal= theOrdinal;
}
/**
* Returns the enum constant of the specified enum type with the specified name.
*
* Note: This method (signature only) is required by the JDK compiler!
*/
public static > T valueOf(Class enumType, String name)
{
ScriptHelper.put("enumType", enumType, null);
ScriptHelper.put("name", name, null);
return (T) ScriptHelper.eval("enumType.$$$nativeClass.$$clinit_()[\"$$$\"+name]", null);
}
/**
* Returns the ordinal of this enumeration constant.
*/
public int ordinal()
{
return ordinal;
}
/**
* Returns the name of this enum constant.
*/
public String toString()
{
return desc;
}
public String name()
{
//TODO revisar
return null;
}
}