Package org.apache.openjpa.lib.util

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


        for (int i = 0; i < _fields.length; i++) {
            if (_fields[i].getObjectIdFieldType() != Object.class)
                continue;
            code.tab(2).append("throw new UnsupportedOperationException").
                parens().append(";").endl();
            code.closeBrace(2);
            return code.toString();
        }

        if (toke != null) {
            code.tab(2).append(toke).append(" toke = ");
View Full Code Here


            }
            code.tab(2).append(getConversionCode(_fields[i], "str")).endl();
        }
        if (_abstract || hasSuperclass)
            code.tab(2).append("return toke;").endl();
        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Returns the type of tokenizer to use, or null if none.
View Full Code Here

        if (_fields.length == 0)
            code.tab(2).append("return true;").endl();
        else
            code.append(";").endl();

        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Return a hashCode method that takes into account all
View Full Code Here

                appendHashCodeCode(_fields[i], code);
                code.append(";").endl();
            }
            code.tab(2).append("return rs;").endl();
        }
        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Return true if this class has a concrete superclass.
View Full Code Here

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

    /**
     * Code to convert a string to a byte array.
View Full Code Here

            append("digit2 >= 'A' && digit2 <= 'F'").closeParen().endl();
        code.tab(4).append("digit2 -= 'A' - 10;").endl(2);
        code.tab(3).append("r[i] = (byte) ").openParen(false).
            openParen(false).append("digit1 << 4").closeParen().
            append(" + digit2").closeParen().append(";").endl();
        code.closeBrace(3).endl();
        code.tab(2).append("return r;").endl();

        code.closeBrace(2);
        return code.toString();
    }
View Full Code Here

            openParen(false).append("digit1 << 4").closeParen().
            append(" + digit2").closeParen().append(";").endl();
        code.closeBrace(3).endl();
        code.tab(2).append("return r;").endl();

        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Code to convert a byte array to a string.
View Full Code Here

            openParen(false).append("j * 4").closeParen().closeParen().
            append(" & 0xF]").closeParen().append(";").endl();
        code.tab(2).append("return r.toString").parens().
            append(";").endl();

        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Code to test if two byte arrays are equal.
View Full Code Here

        code.tab(3).append("if").openParen(true).
            append("b1[i] != b2[i]").closeParen().endl();
        code.tab(4).append("return false;").endl();
        code.tab(2).append("return true;").endl();

        code.closeBrace(2);
        return code.toString();
    }

    private String getHashCodeByteArrayCode() {
        CodeFormat code = newCodeFormat();
View Full Code Here

        code.tab(2).append("for").openParen(true).
            append("int i = 0; i < b.length; i++").closeParen().endl();
        code.tab(3).append("sum += b[i];").endl();
        code.tab(2).append("return sum;").endl();

        code.closeBrace(2);
        return code.toString();
    }

    /**
     * Code defining a tokenizer class.
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.