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

mplates.1.2.source-code.GWTEnum.ftl Maven / Gradle / Ivy

<#include "license.ftl">
<@license/>
<#assign enums = doc.enums>
package ${enums.package}.gwt.model.enums;

import redora.client.EnumDisplay;

import ${enums.package}.gwt.constants.GlobalEnumConstants;

/**
<#if enums.enum[0].@description[0]??>
 * ${enums.enum[0].@description} 

 * Global enumeration. Can be used by several pojo's.
 * @author Redora (www.redora.net)
*/
public enum ${enums.name} implements EnumDisplay {

<#list doc["//element"] as value>
    <#if value.description[0]??>
    /** ${value.description} */
    
    ${value.@name}(
            ((GlobalEnumConstants)com.google.gwt.core.client.GWT.create(GlobalEnumConstants.class)).${enums.fieldName}_${value.@name}_table()
            , ((GlobalEnumConstants)com.google.gwt.core.client.GWT.create(GlobalEnumConstants.class)).${enums.fieldName}_${value.@name}_form())<#if value_has_next>,<#else>;


    String displayForm;
    String displayTable;

    ${enums.name}(String table, String form) {
        displayTable = table;
        displayForm = form;
    }

    @Override
    public String displayForm() {
        return displayForm;
    }

    @Override
    public String displayTable() {
        return displayTable;
    }

    /** @return Null, or the result of valueOf() */
    public static ${enums.name} valueOfNullSafe(String value) {
        if (value != null && value.length() > 0) {
            return valueOf(value);
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy