package $omPojoPackage;

import java.util.List;

import org.apache.commons.lang.enum.Enum;
import org.asyrinx.brownie.core.lang.enum.ValuedEnum;

/** 
 * 
#if ($addTimeStamp)
 * generated by joey-gen on $now
#end
 */
public class $enum.getName() extends ValuedEnum {
	private $enum.getName()(String caption, $enum.getValueType() value) {
#if ( $enum.isPrimitiveValueType() )
		super(caption, new $enum.getValueClass()(value) );
#else
		super(caption, value);
#end
	}
	public $enum.getValueType() as$stringUtils.capitalize( $enum.getValueType() ) () {
#if ( $enum.isPrimitiveValueType() )
		return (($enum.getValueClass()) getValue()).${enum.getValueType()}Value();
#else
		return ($enum.getValueClass()) getValue();
#end
	}
	public static $enum.getName() get($enum.getValueType() value) {
#set ( $classSigniture = "class" )
		return ($enum.getName()) ValuedEnum.getEnum(
			${enum.getName()}.$classSigniture,
#if ( $enum.isPrimitiveValueType() )
			new $enum.getValueClass()(value));
#else
			value);
#end
	}

	public static List getList() {
		return Enum.getEnumList(${enum.getName()}.class);
	}
	public static ${enum.getName()} getEnum(String name) {
		return (${enum.getName()}) Enum.getEnum(${enum.getName()}.class, name);
	}
	public String toString() {
		return getName();
	}
	
	#foreach ( $entry in $enum.getEntries() )
		#set( $entryName = $entry.getName() )
		#set( $entryLabel = $entry.getLabel() )
		#set( $entryValue = $entry.getValue() )
		#if ( $enum.getValueType() == "String" )
			#set ( $entryValue = "'$entryValue'" )
		#end
		#if ( $enum.isPrimitiveValueType() )
	public static final $enum.getName() $entryName.toUpperCase() = new $enum.getName()("$entryLabel", $entryValue);
		#else
	public static final $enum.getName() $entryName.toUpperCase() = new $enum.getName()("$entryLabel", new ${enum.getValueClass()}($entryValue) );
		#end
	#end
}