private Statement createResultSetNullMapping( Expression object, Expression resultSet, PropertyDeclaration property) { return f.newIfStatement( new ExpressionBuilder(f, resultSet) .method("wasNull") //$NON-NLS-1$ .toExpression(), f.newBlock(setNullToProperty(object, property))); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
private Statement createNullCheck(SimpleName parameter) { assert parameter != null; return f.newIfStatement( new ExpressionBuilder(f, parameter) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class)) .newObject(Models.toLiteral(f, MessageFormat.format( "{0} must not be null", //$NON-NLS-1$ parameter.getToken()))) .toThrowStatement())); }
.method("read") //$NON-NLS-1$ .toLocalVariableDeclaration(context.resolve(int.class), c)); body.add(f.newIfStatement( new ExpressionBuilder(f, c) .apply(InfixOperator.LESS, Models.toLiteral(f, 0)) .toExpression(), f.newBlock(f.newBreakStatement()))); body.add(f.newIfStatement( new ExpressionBuilder(f, c) .apply(InfixOperator.EQUALS, Models.toLiteral(f, '\n'))
cases.add(f.newReturnStatement(Models.toNullLiteral(f))); List<Statement> statements = new ArrayList<>(); statements.add(f.newIfStatement( f.newUnaryExpression(UnaryOperator.NOT, f.newInstanceofExpression(key, context.resolve(String.class))), f.newBlock(f.newReturnStatement(Models.toNullLiteral(f)))));
statements.add(f.newIfStatement( new ExpressionBuilder(f, resultSet) .method("next") //$NON-NLS-1$
private Statement createPreparedStatementSupportStatement( Expression object, Expression statement, Expression position, PropertyDeclaration property) { assert object != null; assert statement != null; assert position != null; assert property != null; return f.newIfStatement( new ExpressionBuilder(f, position) .apply(InfixOperator.NOT_EQUALS, Models.toLiteral(f, 0)) .toExpression(), f.newBlock(f.newIfStatement( new ExpressionBuilder(f, object) .method(context.getOptionGetterName(property)) .method("isNull") //$NON-NLS-1$ .toExpression(), f.newBlock(new ExpressionBuilder(f, statement) .method("setNull", position, createNullType(property)) //$NON-NLS-1$ .toStatement()), f.newBlock(createParameterSetter(object, statement, position, property))))); }
statements.add(f.newIfStatement( new ExpressionBuilder(f, parser) .method("next") //$NON-NLS-1$
statements.add(f.newIfStatement(head, f.newBlock(headerStatements))); arguments.add(headers); } else { .toLocalVariableDeclaration(context.resolve(CsvConfiguration.class), config)); if (conf.isForceHeader()) { statements.add(f.newIfStatement(head, f.newBlock(new ExpressionBuilder(f, config) .method("setForceConsumeHeader", Models.toLiteral(f, conf.isForceHeader())) //$NON-NLS-1$ .toStatement())));
.method("getString", position) //$NON-NLS-1$ .toLocalVariableDeclaration(context.resolve(String.class), value)); statements.add(f.newIfStatement( new ExpressionBuilder(f, value) .apply(InfixOperator.NOT_EQUALS, Models.toNullLiteral(f)) .method("getDate", position, calendar) //$NON-NLS-1$ .toLocalVariableDeclaration(context.resolve(java.sql.Date.class), value)); statements.add(f.newIfStatement( new ExpressionBuilder(f, value) .apply(InfixOperator.NOT_EQUALS, Models.toNullLiteral(f)) .method("getTimestamp", position, calendar) //$NON-NLS-1$ .toLocalVariableDeclaration(context.resolve(java.sql.Timestamp.class), value)); statements.add(f.newIfStatement( new ExpressionBuilder(f, value) .apply(InfixOperator.NOT_EQUALS, Models.toNullLiteral(f)) throw new AssertionError(kind); return f.newIfStatement( new ExpressionBuilder(f, position) .apply(InfixOperator.NOT_EQUALS, Models.toLiteral(f, 0))
List<Statement> statements = new ArrayList<>(); SimpleName obj = context.createVariableName("obj"); //$NON-NLS-1$ statements.add(f.newIfStatement( new ExpressionBuilder(f, f.newThis()) .apply(InfixOperator.EQUALS, obj) .toExpression(), f.newBlock(f.newReturnStatement(Models.toLiteral(f, true))))); statements.add(f.newIfStatement( new ExpressionBuilder(f, obj) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f)) .toExpression(), f.newBlock(f.newReturnStatement(Models.toLiteral(f, false))))); statements.add(f.newIfStatement( new ExpressionBuilder(f, f.newThis()) .method("getClass") //$NON-NLS-1$ for (PropertyDeclaration property : model.getDeclaredProperties()) { SimpleName field = context.getFieldName(property); statements.add(f.newIfStatement( new ExpressionBuilder(f, f.newThis()) .field(field)
List<Statement> statements = new ArrayList<>(); statements.add(createNullCheck(columnNames)); statements.add(f.newIfStatement( new ExpressionBuilder(f, columnNames) .method("isEmpty") //$NON-NLS-1$
statements.add(f.newIfStatement( new ExpressionBuilder(f, parser) .method("next") //$NON-NLS-1$
.toExpression(); if (isFastMode() == false) { statements.add(f.newIfStatement( isNotHead, f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class))
.toExpression(); if (isFastMode() == false) { statements.add(f.newIfStatement( isNotHead, f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class))
.method("get", column) //$NON-NLS-1$ .toLocalVariableDeclaration(context.resolve(Integer.class), position), f.newIfStatement( new ExpressionBuilder(f, position) .apply(InfixOperator.EQUALS, Models.toNullLiteral(f))