@Override public Node visit(BooleanLiteralExpr _n, Object _arg) { Comment comment = cloneNodes(_n.getComment(), _arg); BooleanLiteralExpr r = new BooleanLiteralExpr( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getValue() ); r.setComment(comment); return r; }
public BooleanLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, boolean value) { super(beginLine, beginColumn, endLine, endColumn); setValue(value); }
@Override public void visit(final BooleanLiteralExpr n, final Object arg) { printJavaComment(n.getComment(), arg); printer.print(String.valueOf(n.getValue())); }
private AnnotationExpr createJoinColumn(FieldDescriptor thisField, FieldDescriptor itemField) { final List<MemberValuePair> pairs = new ArrayList<MemberValuePair>(); pairs.add(new MemberValuePair("name", new StringLiteralExpr(thisField.getColumnName()))); pairs.add(new MemberValuePair("referencedColumnName", new StringLiteralExpr(itemField.getColumnName()))); if (!isAnonymousFk(thisField)) { pairs.add(new MemberValuePair("insertable", new BooleanLiteralExpr(false))); pairs.add(new MemberValuePair("updatable", new BooleanLiteralExpr(false))); } // Per this page: https://forums.oracle.com/message/3923913 // the nullable attribute is a hint to the DDL generation, especially on fields like this. // Commenting this flag out for now as it's just "noise" in the annotation definitions // if (!isNullableFk(thisField)) { // pairs.add(new MemberValuePair("nullable", new BooleanLiteralExpr(false))); // } return new NormalAnnotationExpr(new NameExpr("JoinColumn"), pairs); }
@Override public void visit(final BooleanLiteralExpr n, final A arg) { visitComment(n.getComment(), arg); }
final public Expression BooleanLiteral() throws ParseException { Expression ret; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: jj_consume_token(TRUE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, true); break; case FALSE: jj_consume_token(FALSE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, false); break; default: jj_la1[95] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
@Override public XAnnotationValue<Boolean> visit(BooleanLiteralExpr n, Void arg) { return new XBooleanAnnotationValue(n.getValue()); } }
final public Expression BooleanLiteral() throws ParseException { Expression ret; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: jj_consume_token(TRUE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, true); break; case FALSE: jj_consume_token(FALSE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, false); break; default: jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
public void visit(BooleanLiteralExpr n, Object arg) { printer.print(String.valueOf(n.getValue())); }
public BooleanLiteralExpr(boolean value) { setValue(value); }
final String access = fd.getAccess(); if ("readonly".equals(access)) { pairs.add(new MemberValuePair("insertable", new BooleanLiteralExpr(false))); pairs.add(new MemberValuePair("updatable", new BooleanLiteralExpr(false))); } else if ("readwrite".equals(access)) { LOG.debug(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field access is readwrite keeping @Column attributes (insertable, updatable) at defaults"); pairs.add(new MemberValuePair("nullable", new BooleanLiteralExpr(false))); } else { LOG.debug(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field is nullable keeping @Column attribute (nullable) at default");
private NodeAndImports<MethodDeclaration> createPrimaryKeyEquals(Collection<FieldDescriptor> primaryKeyDescriptors, String enclosingClassName) { final MethodDeclaration equals = new MethodDeclaration(ModifierSet.PUBLIC, new PrimitiveType(PrimitiveType.Primitive.Boolean), "equals", Collections.singletonList(new Parameter(new ClassOrInterfaceType("Object"), new VariableDeclaratorId("other")))); equals.setAnnotations(Collections.<AnnotationExpr>singletonList(new MarkerAnnotationExpr(new NameExpr("Override")))); final Statement ifEqualNullStmt = new IfStmt(new BinaryExpr(new NameExpr("other"), new NullLiteralExpr(), BinaryExpr.Operator.equals), new ReturnStmt(new BooleanLiteralExpr(false)), null); final Statement ifEqualThisStmt = new IfStmt(new BinaryExpr(new NameExpr("other"), new ThisExpr(), BinaryExpr.Operator.equals), new ReturnStmt(new BooleanLiteralExpr(true)), null); final Statement ifEqualClassStmt = new IfStmt(new BinaryExpr(new MethodCallExpr(new NameExpr("other"), "getClass"), new MethodCallExpr(new ThisExpr(), "getClass"), BinaryExpr.Operator.notEquals), new ReturnStmt(new BooleanLiteralExpr(false)), null); final Statement rhsStmt = new ExpressionStmt(new VariableDeclarationExpr(ModifierSet.FINAL, new ClassOrInterfaceType(enclosingClassName), Collections.singletonList(new VariableDeclarator( new VariableDeclaratorId("rhs"), new CastExpr(new ClassOrInterfaceType(enclosingClassName), new NameExpr("other")))))); Expression equalsBuilderExpr = new ObjectCreationExpr(null, new ClassOrInterfaceType("EqualsBuilder"), Collections.<Expression>emptyList()); for (FieldDescriptor f : primaryKeyDescriptors) { final List<Expression> args = new ArrayList<Expression>(); args.add(new FieldAccessExpr(new ThisExpr(), f.getAttributeName())); args.add(new FieldAccessExpr(new NameExpr("rhs"), f.getAttributeName())); equalsBuilderExpr = new MethodCallExpr(equalsBuilderExpr, "append", args); } equalsBuilderExpr = new MethodCallExpr(equalsBuilderExpr, "isEquals"); final List<Statement> statements = new ArrayList<Statement>(); statements.add(ifEqualNullStmt); statements.add(ifEqualThisStmt); statements.add(ifEqualClassStmt); statements.add(rhsStmt); statements.add(new ReturnStmt(equalsBuilderExpr)); final BlockStmt equalsBody = new BlockStmt(statements); equals.setBody(equalsBody); return new NodeAndImports<MethodDeclaration>(equals, Collections.singleton(new ImportDeclaration(new QualifiedNameExpr(new NameExpr("org.apache.commons.lang.builder"), "EqualsBuilder"), false, false))); }
} else if (autoDelete == ObjectReferenceDescriptor.CASCADE_OBJECT) { cascadeTypes.add(new NameExpr("CascadeType.REMOVE")); pairs.add(new MemberValuePair("orphanRemoval", new BooleanLiteralExpr(true))); } else { LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has auto-delete set to an invalid value");
} else if (autoDelete == ObjectReferenceDescriptor.CASCADE_OBJECT) { cascadeTypes.add(new NameExpr("CascadeType.REMOVE")); pairs.add(new MemberValuePair("orphanRemoval", new BooleanLiteralExpr(true))); } else { LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has auto-delete set to an invalid value");