类模板 单例模板

类模板
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
public  #if (${ABSTRACT} == "TRUE")abstract #end #if (${FINAL} == "TRUE")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
    private static final String TAG = ${NAME}.class.getSimpleName();
}


单例类模板
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
public class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
    private static final String TAG = ${NAME}.class.getSimpleName();

    #if (${VISIBILITY} == "PUBLIC")public #end static ${NAME} getInstance() {
        return ${NAME}Holder.instance;
    }

    private ${NAME}() {
    }

    private static class ${NAME}Holder{
        public static ${NAME} instance = new ${NAME}();
    }
}
 

猜你喜欢

转载自blog.csdn.net/u013749540/article/details/81115231