contentStart.gte(JExpr.lit(0)).cand(contentEnd.gt(contentStart)));
private JExpression buildQNameCompare(QName name, JExpression localPart, JExpression namespaceUri) { JExpression localInv = JExpr.lit(name.getLocalPart()).eq(localPart); String ns = name.getNamespaceURI(); JExpression nsInv = JExpr.lit(ns).eq(namespaceUri); if (ns.equals("")) { nsInv = nsInv.cor(namespaceUri.eq(JExpr._null())); } JExpression qnameCompare = localInv.cand(nsInv); return qnameCompare; }
public JExpression hasSetValue() { return propertyField.ne(JExpr._null()).cand( propertyField.invoke("isEmpty").not()); }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return propertyField.ne(JExpr._null()).cand( propertyField.invoke("isEmpty").not()); }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.invoke("isEmpty").not()); } }
@Override public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.ref("length").gt(JExpr.lit(0))); }
@Override public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.ref("length").gt(JExpr.lit(0))); }
@Override public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.ref("length").gt(JExpr.lit(0))); }
@Override public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.ref("length").gt(JExpr.lit(0))); }
@Override public JExpression hasSetValue() { return field.ne(JExpr._null()).cand(field.ref("length").gt(JExpr.lit(0))); }
public void createEquals(final JDefinedClass bean, final Iterable<JFieldVar> fields) { final JMethod method = bean.method(JMod.PUBLIC, this.codeModel.BOOLEAN, "equals"); method.annotate(java.lang.Override.class); final JVar object = method.param(_type(java.lang.Object.class.getName()), "object"); final JBlock block = method.body(); block._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); block._if(object._instanceof(bean).not())._then()._return(JExpr.FALSE); JExpression result = JExpr.TRUE; final JExpression other = block.decl(bean, "other", JExpr.cast(bean, object)); final JClass objectUtilities = _classByNames(net.anwiba.commons.lang.object.ObjectUtilities.class.getName()); for (final JFieldVar field : fields) { result = result.cand(objectUtilities.staticInvoke("equals").arg(JExpr.refthis(field.name())).arg(other.ref(field))); } block._return(result); } }
private void declareEqualsMethod(JCodeModel model, TypeInfo pair) { JDefinedClass dc = pair.implClass; JDefinedClass dci = pair.interfaceClass; JFieldRef idField = JExpr.ref("id"); JMethod method = dc.method(JMod.PUBLIC, boolean.class, "equals"); JVar param = method.param(Object.class, "other"); JBlock body = method.body(); body._if(idField.ne(JExpr._null()).cand(param._instanceof(dci))) ._then()._return(idField.invoke("equals").arg( ((JExpression)JExpr.cast(dci, param)).invoke("getId"))); body._return(JExpr._this().eq(param)); }
private void generateEquals() { equalsGeneric = cls().method(JMod.PUBLIC, cm.BOOLEAN, "equals"); equalsGeneric.param(cm.ref("java.lang.Object"), "other"); equalsGeneric.body().block()._if(_this().eq(ref("other"))) ._then() ._return(TRUE); equalsGeneric.body().block()._if( ref("other").eq(_null()) .cor((ref("other")._instanceof(cls()).not()))) ._then() ._return(FALSE); equalsGeneric.body().block()._return(_this().invoke("equals").arg(cast(cls(), ref("other")))); equalsTypeSpecific = cls().method(JMod.PUBLIC, cm.BOOLEAN, "equals"); equalsTypeSpecific.param(cls(), "other"); equalsTypeSpecific.body().block()._if(ref("other").eq(_null()))._then()._return(FALSE); JConditional test = equalsTypeSpecific.body().block()._if(_this().ref("value").eq(_null()).cand(ref("other").invoke("getValue").ne(_null()))); test._then().block()._return(FALSE); JConditional test2 = test._elseif(_this().ref("value").ne(_null()).cand(ref("other").invoke("getValue").eq(_null()))); test2._then().block()._return(FALSE); JConditional test3 = test2._elseif(_this().ref("value").eq(_null()).cand(ref("other").invoke("getValue").eq(_null()))); test3._then().block()._return(TRUE); test3._else().block()._return(_this().ref("value").invoke("equals").arg(ref("other").invoke("getValue"))); }