Package org.apache.openjpa.lib.util

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


            cons.append(fieldType).append(" ").append(propertyName);

            if (_meta.getPCSuperclass() == null) {
                if (i > 0)
                    body.endl();
                body.tab(2);
                if (propertyName.equals(fields[i].getName()))
                    body.append("this.");
                body.append(fields[i].getName());
                body.append(" = ").append(propertyName).append(";");
            } else {
View Full Code Here


                body.append(fields[i].getName());
                body.append(" = ").append(propertyName).append(";");
            } else {
                // super (...);
                if (i == 0)
                    body.tab(2).append("super").openParen(true);
                else
                    body.append(", ");
                body.append(propertyName);
                if (i == fields.length - 1)
                    body.closeParen().append(";");
View Full Code Here

        if (fieldDecs.length() > 0)
            code.append(fieldDecs).afterSection();

        // default constructor
        code.tab().append("public ").append(className).parens();
        code.openBrace(2).endl().closeBrace(2);

        if (constructor.length() > 0)
            code.afterSection().append(constructor);
        if (fieldCode.length() > 0)
View Full Code Here

                    append(name).closeParen();
        }

        // no fields; just use ""
        if (_fields.length == 0)
            code.tab(2).append("return \"\"");
        code.append(";").endl();
        code.closeBrace(2);
        return code.toString();
    }
View Full Code Here

     *
     * @see org.apache.openjpa.lib.util.Base16Encoder#decode
     */
    private String getToBytesByteArrayCode() {
        CodeFormat code = newCodeFormat();
        code.tab().append("private static byte[] toBytes").openParen(true).
            append("String s").closeParen().openBrace(2).endl();

        code.tab(2).append("if").openParen(true).append("\"null\".equals").
            openParen(true).append("s").closeParen().closeParen().endl();
        code.tab(3).append("return null;").endl(2);
View Full Code Here

    private String getToBytesByteArrayCode() {
        CodeFormat code = newCodeFormat();
        code.tab().append("private static byte[] toBytes").openParen(true).
            append("String s").closeParen().openBrace(2).endl();

        code.tab(2).append("if").openParen(true).append("\"null\".equals").
            openParen(true).append("s").closeParen().closeParen().endl();
        code.tab(3).append("return null;").endl(2);

        code.tab(2).append("int len = s.length").parens().
            append(";").endl();
View Full Code Here

        code.tab().append("private static byte[] toBytes").openParen(true).
            append("String s").closeParen().openBrace(2).endl();

        code.tab(2).append("if").openParen(true).append("\"null\".equals").
            openParen(true).append("s").closeParen().closeParen().endl();
        code.tab(3).append("return null;").endl(2);

        code.tab(2).append("int len = s.length").parens().
            append(";").endl();
        code.tab(2).append("byte[] r = new byte[len / 2];").endl();
        code.tab(2).append("for").openParen(true).
View Full Code Here

        code.tab(2).append("if").openParen(true).append("\"null\".equals").
            openParen(true).append("s").closeParen().closeParen().endl();
        code.tab(3).append("return null;").endl(2);

        code.tab(2).append("int len = s.length").parens().
            append(";").endl();
        code.tab(2).append("byte[] r = new byte[len / 2];").endl();
        code.tab(2).append("for").openParen(true).
            append("int i = 0; i < r.length; i++").closeParen().
            openBrace(3).endl();
View Full Code Here

            openParen(true).append("s").closeParen().closeParen().endl();
        code.tab(3).append("return null;").endl(2);

        code.tab(2).append("int len = s.length").parens().
            append(";").endl();
        code.tab(2).append("byte[] r = new byte[len / 2];").endl();
        code.tab(2).append("for").openParen(true).
            append("int i = 0; i < r.length; i++").closeParen().
            openBrace(3).endl();
        code.tab(3).append("int digit1 = s.charAt").openParen(true).
            append("i * 2").closeParen().append(", ").
View Full Code Here

        code.tab(3).append("return null;").endl(2);

        code.tab(2).append("int len = s.length").parens().
            append(";").endl();
        code.tab(2).append("byte[] r = new byte[len / 2];").endl();
        code.tab(2).append("for").openParen(true).
            append("int i = 0; i < r.length; i++").closeParen().
            openBrace(3).endl();
        code.tab(3).append("int digit1 = s.charAt").openParen(true).
            append("i * 2").closeParen().append(", ").
            append("digit2 = s.charAt").openParen(true).
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.