${database.allClassCopyright}package ${glPackageBaseCommon};

import java.util.HashMap;
import java.util.Map;

import org.seasar.dbflute.jdbc.Classification;

/**
 * The definition of classification.
 * @author ${database.classAuthor}
 */
public interface ${glCDef} extends Classification {

#foreach ($classificationName in $database.classificationNameList)
#set ($classificationMapList = $database.classificationDefinitionMap.get($classificationName))
#set ($existTop = false)
#if ($database.classificationTopDefinitionMap.containsKey($classificationName))
  #set ($classificationTopMap = $database.classificationTopDefinitionMap.get($classificationName))
  #set ($existTop = true)
#end
#if ($database.isInitNumber($classificationName))
    // The classification name that its initial character is number is unsupported!
    // public enum ${classificationName} {
    // }

#else
#if ($existTop && $classificationTopMap.containsKey('topComment'))
    /**
     * $classificationTopMap.get('topComment')
     */
#end
    public enum ${classificationName} implements ${glCDef} {
#set ($count = 0)
#foreach ($classificationMap in $classificationMapList)
#if ($count != 0)
        ,
#end
        /** $database.buildClassificationApplicationComment($classificationMap) */
        ${classificationMap.get('name')}($database.buildClassificationCodeAliasVariables($classificationMap))
#set ($count = $count + 1)
#end
        ;
        private static final Map<String, ${classificationName}> _codeValueMap = new HashMap<String, ${classificationName}>();
        static { for (${classificationName} value : values()) { _codeValueMap.put(value.code().toLowerCase(), value); } }
        private String _code; private String _alias;
        private ${classificationName}(String code, String alias) { _code = code; _alias = alias; }
        public String code() { return _code; } public String alias() { return _alias; }
#if ($existTop && $classificationTopMap.containsKey('dataType'))
        public Classification.DataType dataType() { return Classification.DataType.${classificationTopMap.get('dataType')}; }
#else
        public Classification.DataType dataType() { return Classification.DataType.String; }
#end
        public static ${classificationName} codeOf(Object code) {
            if (code == null) { return null; } if (code instanceof ${classificationName}) { return (${classificationName})code; }
            return _codeValueMap.get(code.toString().toLowerCase());
        }
#if ($database.isCDefToStringReturnsName())
        @Override public String toString() { return name(); }
#else
        @Override public String toString() { return code(); }
#end
    }

#end
#end
}
