.method("getInstance")
.toExpression());
}
private ClassDeclaration createPreparedStatementSupportClass() {
SimpleName preparedStatement = f.newSimpleName("statement");
SimpleName properties = f.newSimpleName("properties");
List<TypeBodyDeclaration> members = Lists.create();
members.add(createPrivateField(PreparedStatement.class, preparedStatement, false));
members.add(createPrivateField(int[].class, properties, false));
Set<BasicTypeKind> kinds = collectTypeKinds();
if (kinds.contains(BasicTypeKind.DATE)) {
members.add(f.newFieldDeclaration(
null,
new AttributeBuilder(f)
.Private()
.Final()
.toAttributes(),
context.resolve(java.sql.Date.class),
f.newSimpleName(NAME_DATE),
new TypeBuilder(f, context.resolve(java.sql.Date.class))
.newObject(Models.toLiteral(f, 0L))
.toExpression()));
}
if (kinds.contains(BasicTypeKind.DATETIME)) {
members.add(f.newFieldDeclaration(
null,
new AttributeBuilder(f)
.Private()
.Final()
.toAttributes(),
context.resolve(java.sql.Timestamp.class),
f.newSimpleName(NAME_DATETIME),
new TypeBuilder(f, context.resolve(java.sql.Timestamp.class))
.newObject(Models.toLiteral(f, 0L))
.toExpression()));
}
if (kinds.contains(BasicTypeKind.DATE) || kinds.contains(BasicTypeKind.DATETIME)) {
members.add(createCalendarBuffer());
}
members.add(f.newConstructorDeclaration(
null,
new AttributeBuilder(f).toAttributes(),
f.newSimpleName(NAME_PREPARED_STATEMENT_SUPPORT),
Arrays.asList(
f.newFormalParameterDeclaration(
context.resolve(PreparedStatement.class), preparedStatement),
f.newFormalParameterDeclaration(
context.resolve(int[].class), properties)),
Arrays.asList(mapField(preparedStatement), mapField(properties))));
SimpleName object = f.newSimpleName("object");
List<Statement> statements = Lists.create();
List<PropertyDeclaration> declared = getProperties();
for (int i = 0, n = declared.size(); i < n; i++) {
statements.add(createPreparedStatementSupportStatement(
object,