Package org.apache.openjpa.lib.util

Examples of org.apache.openjpa.lib.util.CodeFormat.tab()


        code.tab(4).append("part = str.substring").openParen(true).
            append("last, next").closeParen().append(";").endl();
        code.tab(4).append("last = next + ").append(_token.length()).
            append(";").endl().closeBrace(4).endl();

        code.tab(3).append("return part;").endl();
        code.closeBrace(3);
        code.endl().closeBrace(2);
        return code.toString();
    }
View Full Code Here


        }
        code.append("implements Serializable").openBrace(1).endl();

        // if we use a byte array we need a static array for encoding to string
        if (bytes) {
            code.tab().append("private static final char[] HEX = ").
                append("new char[] {").endl();
            code.tab(2).append("'0', '1', '2', '3', '4', '5', '6', '7',").
                endl();
            code.tab(2).append("'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'").
                endl();
View Full Code Here

        // if we use a byte array we need a static array for encoding to string
        if (bytes) {
            code.tab().append("private static final char[] HEX = ").
                append("new char[] {").endl();
            code.tab(2).append("'0', '1', '2', '3', '4', '5', '6', '7',").
                endl();
            code.tab(2).append("'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'").
                endl();
            code.tab().append("};").endl(2);
        }
View Full Code Here

        if (bytes) {
            code.tab().append("private static final char[] HEX = ").
                append("new char[] {").endl();
            code.tab(2).append("'0', '1', '2', '3', '4', '5', '6', '7',").
                endl();
            code.tab(2).append("'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'").
                endl();
            code.tab().append("};").endl(2);
        }

        // static block to register class
View Full Code Here

                append("new char[] {").endl();
            code.tab(2).append("'0', '1', '2', '3', '4', '5', '6', '7',").
                endl();
            code.tab(2).append("'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'").
                endl();
            code.tab().append("};").endl(2);
        }

        // static block to register class
        code.tab().append("static").openBrace(2).endl();
        code.tab(2).append("// register persistent class in JVM").endl();
View Full Code Here

                endl();
            code.tab().append("};").endl(2);
        }

        // static block to register class
        code.tab().append("static").openBrace(2).endl();
        code.tab(2).append("// register persistent class in JVM").endl();
        if (JavaVersions.VERSION >= 5) {
            code.tab(2).append("try { Class.forName").openParen(true).
                append("\"").append(_type.getName()).append("\"").
                closeParen().append(";").append(" }").endl();
View Full Code Here

            code.tab().append("};").endl(2);
        }

        // static block to register class
        code.tab().append("static").openBrace(2).endl();
        code.tab(2).append("// register persistent class in JVM").endl();
        if (JavaVersions.VERSION >= 5) {
            code.tab(2).append("try { Class.forName").openParen(true).
                append("\"").append(_type.getName()).append("\"").
                closeParen().append(";").append(" }").endl();
            code.tab(2).append("catch").openParen(true).
View Full Code Here

        // static block to register class
        code.tab().append("static").openBrace(2).endl();
        code.tab(2).append("// register persistent class in JVM").endl();
        if (JavaVersions.VERSION >= 5) {
            code.tab(2).append("try { Class.forName").openParen(true).
                append("\"").append(_type.getName()).append("\"").
                closeParen().append(";").append(" }").endl();
            code.tab(2).append("catch").openParen(true).
                append("Exception e").closeParen().append(" {}").endl();
        } else
View Full Code Here

        code.tab(2).append("// register persistent class in JVM").endl();
        if (JavaVersions.VERSION >= 5) {
            code.tab(2).append("try { Class.forName").openParen(true).
                append("\"").append(_type.getName()).append("\"").
                closeParen().append(";").append(" }").endl();
            code.tab(2).append("catch").openParen(true).
                append("Exception e").closeParen().append(" {}").endl();
        } else
            code.tab(2).append("Class c = ").append(_type.getName()).
                append(".class;").endl();
        code.closeBrace(2);
View Full Code Here

                append("\"").append(_type.getName()).append("\"").
                closeParen().append(";").append(" }").endl();
            code.tab(2).append("catch").openParen(true).
                append("Exception e").closeParen().append(" {}").endl();
        } else
            code.tab(2).append("Class c = ").append(_type.getName()).
                append(".class;").endl();
        code.closeBrace(2);

        // field declarations
        if (fieldDecs.length() > 0)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.