sub.assign(workspaceJVars[3].component(JExpr.lit(i)), workspaceJVars[2].component(JExpr.lit(i))); JBlock conditionalBlock = new JBlock(false, false); JConditional jc = conditionalBlock._if(inputVariables[i].getIsSet().ne(JExpr.lit(0))); jc._then().assign(JExpr.ref(workspaceJVars[3].component(JExpr.lit(i)), "valueHolder"), inputVariables[i].getHolder()); jc._else().assign(JExpr.ref(workspaceJVars[3].component(JExpr.lit(i)), "valueHolder"), JExpr._null());
} else { fieldEquals = thisFieldRef.eq(otherFieldRef).cor( thisFieldRef.ne(JExpr._null()) .cand(thisFieldRef.invoke("equals").arg(otherFieldRef)));
private JMethod addPublicGetMethod(JDefinedClass jclass, JMethod internalGetMethod, JFieldRef notFoundValue) { JMethod method = jclass.method(PUBLIC, jclass.owner()._ref(Object.class), GETTER_NAME); JTypeVar returnType = method.generify("T"); method.type(returnType); Models.suppressWarnings(method, "unchecked"); JVar nameParam = method.param(String.class, "name"); JBlock body = method.body(); JVar valueVar = body.decl(jclass.owner()._ref(Object.class), "value", invoke(internalGetMethod).arg(nameParam).arg(notFoundValue)); JConditional found = method.body()._if(notFoundValue.ne(valueVar)); found._then()._return(cast(returnType, valueVar)); JBlock notFound = found._else(); JMethod getAdditionalProperties = jclass.getMethod("getAdditionalProperties", new JType[] {}); if (getAdditionalProperties != null) { notFound._return(cast(returnType, invoke(getAdditionalProperties).invoke("get").arg(nameParam))); } else { notFound._throw(illegalArgumentInvocation(jclass, nameParam)); } return method; }
public JExpression hasSetValue() { return $ref.ne( JExpr._null() ); } }
public JExpression hasSetValue() { return $ref.ne( JExpr._null() ); } }
public JExpression hasSetValue() { return $ref.ne( JExpr._null() ); } }
public JExpression hasSetValue() { return $ref.ne(JExpr._null()); } }
public JExpression hasSetValue() { return $ref.ne( JExpr._null() ); } }
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 propertyField.ne(JExpr._null()).cand( propertyField.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 void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws Exception { Classes classes = holder.classes(); String fieldName = element.getSimpleName().toString(); JFieldRef idRef = annotationHelper.extractOneAnnotationFieldRef(holder, element, Res.STRING, true); JBlock methodBody = holder.afterSetContentView.body(); // methodBody. // _if(ref(fieldName).ne(_null())). // _then() // .invoke(ref(fieldName), "setText").arg(classes.HTML.staticInvoke("fromHtml").arg(holder.contextRef.invoke("getString").arg(idRef))); } }
private void declareHashCodeMethod(JCodeModel model, TypeInfo pair) { JDefinedClass dc = pair.implClass; JMethod method = dc.method(JMod.PUBLIC, int.class, "hashCode"); JFieldRef idField = JExpr.ref("id"); JBlock body = method.body(); body._if(idField.ne(JExpr._null()))._then()._return(idField.invoke("hashCode")); body._return(JExpr._super().invoke("hashCode")); }
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)); }