All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.threerings.presents.tools.enum_as.tmpl Maven / Gradle / Ivy

The newest version!
{{header}}// GENERATED PREAMBLE START
package {{package}} {

{{#importGroups}}
{{#this}}
import {{this}};

{{/this}}
{{/importGroups}}
// GENERATED PREAMBLE END

// GENERATED CLASSDECL START
public final class {{classname}} extends Enum
{
// GENERATED CLASSDECL END

// GENERATED ENUM START
{{#enumFields}}
    public static const {{name}} :{{classname}} = new {{classname}}("{{name}}");
{{/enumFields}}
    finishedEnumerating({{classname}});

    /**
     * Gets the values of the {{classname}} enum.
     */
    public static function values () :Array
    {
        return Enum.values({{classname}});
    }

    /**
     * Gets the {{classname}} instance that corresponds to the specified string.
     * If no such value exists, an ArgumentError will be thrown.
     */
    public static function valueOf (name :String) :{{classname}}
    {
        return Enum.valueOf({{classname}}, name) as {{classname}};
    }

    /** @private */
    public function {{classname}} (name :String)
    {
        super(name);
    }
// GENERATED ENUM END
// GENERATED CLASSFINISH START
}
}
// GENERATED CLASSFINISH END




© 2015 - 2024 Weber Informatics LLC | Privacy Policy