fieldHash = JExpr.cast(jclass.owner().INT, fieldRef.xor(fieldRef.shrz(JExpr.lit(32)))); } else if ("boolean".equals(fieldVar.type().name())) { fieldHash = JOp.cond(fieldRef, JExpr.lit(1), JExpr.lit(0)); } else if ("int".equals(fieldVar.type().name())) { fieldHash = fieldRef; fieldHash = JOp.cond(fieldRef.eq(JExpr._null()), JExpr.lit(0), fieldRef.invoke("hashCode"));
@Override protected JExpression unwrap(JExpression source) { return JOp.cond(source.eq(JExpr._null()), JExpr._null(), source .invoke("value")); }
@Override protected JExpression unwrap(JExpression source) { return JOp.cond(source.eq(JExpr._null()), JExpr._null(), source .invoke("value")); }
public JExpression count() { return JOp.cond( field.eq(JExpr._null()), JExpr.lit(0), field.invoke("size") ); }
public JExpression countLength(final JCodeModel codeModel, final JExpression value) { return JOp.cond(JOp.eq(JExpr._null(), value), JExpr.lit(0), JExpr.invoke(value, "length")); }
public JExpression count() { return JOp.cond( field.eq(JExpr._null()), JExpr.lit(0), field.invoke("size") ); }
public JExpression count() { return JOp.cond( field.eq(JExpr._null()), JExpr.lit(0), field.invoke("size") ); }
public JExpression count() { return JOp.cond( field.eq(JExpr._null()), JExpr.lit(0), field.invoke("size") ); }
@Override protected JExpression marshallValue(EntityDescriptionGenerator.ToRawEntityHolder holder, PropertyMirror propertyMirror) { JExpression getValue = super.marshallValue(holder, propertyMirror); return JOp.cond(getValue.ne(JExpr._null()), getValue.invoke("getId"), JExpr._null()); }
@Override protected JExpression wrap(JExpression target) { return JOp.cond(target.eq(JExpr._null()), JExpr._null(), this.enumClass .staticInvoke("fromValue").arg(target)); }
@Override protected JExpression wrap(JExpression target) { return JOp.cond(target.eq(JExpr._null()), JExpr._null(), this.enumClass .staticInvoke("fromValue").arg(target)); }
public JExpression compare(final JCodeModel codeModel, final JExpression o1, final JExpression o2) { final JExpression left = JExpr.cast(codeModel.ref(Calendar.class), o1); final JExpression right = JExpr.cast(codeModel.ref(Calendar.class), o2); return JOp.cond(left.invoke("before").arg(right), JExpr.lit(Comparator.LESS), JOp.cond(left.invoke("after").arg(right), JExpr.lit(Comparator.GREATER), JExpr.lit(Comparator.EQUAL))); }
@Override public JExpression f(final JVar param) { return JOp.cond(param.ref(propertyName).eq(JExpr._null()), JExpr._null(), param.ref(propertyName).invoke("getValue")); } };
private void createFieldReferenceSetterBody(JFieldVar field, JVar param, JBlock body) { JVar cont = body.decl(CLASS_MAP.get(PrismReferenceValue.class), REFERENCE_VALUE_FIELD_NAME, JOp.cond(param.ne(JExpr._null()), JExpr.invoke(param, METHOD_AS_REFERENCE_VALUE), JExpr._null())); JInvocation invocation = body.staticInvoke(CLASS_MAP.get(PrismForJAXBUtil.class), METHOD_PRISM_UTIL_SET_REFERENCE_VALUE_AS_REF); invocation.arg(JExpr.invoke(METHOD_AS_PRISM_CONTAINER_VALUE)); invocation.arg(JExpr.ref(fieldFPrefixUnderscoredUpperCase(field.name()))); invocation.arg(cont); }
private void createFieldReferenceUseSetterBody(JFieldVar field, ClassOutline classOutline, JVar param, JBlock body) { JVar cont = body.decl(CLASS_MAP.get(PrismObject.class), OBJECT_LOCAL_FIELD_NAME, JOp.cond(param.ne(JExpr._null()), JExpr.invoke(param, METHOD_AS_PRISM_CONTAINER), JExpr._null())); JInvocation invocation = body.staticInvoke(CLASS_MAP.get(PrismForJAXBUtil.class), METHOD_PRISM_UTIL_SET_REFERENCE_VALUE_AS_OBJECT); invocation.arg(JExpr.invoke(METHOD_AS_PRISM_CONTAINER_VALUE)); JFieldVar referencedField = getReferencedField(field, classOutline); invocation.arg(JExpr.ref(fieldFPrefixUnderscoredUpperCase(referencedField.name()))); invocation.arg(cont); }
@Override protected JExpression marshallValue(EntityDescriptionGenerator.ToRawEntityHolder holder, PropertyMirror propertyMirror) { JExpression getValue = super.marshallValue(holder, propertyMirror); JExpression saveEntity = holder.torchFactory .invoke("begin") .invoke("save") .invoke("entity").arg(getValue); return JOp.cond(JOp.ne(getValue, JExpr._null()), saveEntity, JExpr._null()); }
public TreeVarGenerator(final JBlock body, final String fieldName) { this.fieldPathVar = body.decl(JMod.FINAL, PartialCopyGenerator.this.pluginContext.codeModel._ref(PropertyTree.class), fieldName + "PropertyTree", JOp.cond(PartialCopyGenerator.this.propertyTreeParam.eq(JExpr._null()), JExpr._null(),PartialCopyGenerator.this.propertyTreeParam.invoke("get").arg(JExpr.lit(fieldName))) ); }
private JExpression getIncludeCondition(final JVar fieldPathVar) { return JOp.cond( PartialCopyGenerator.this.propertyTreeUseParam.eq(PartialCopyGenerator.this.pluginContext.includeConst), fieldPathVar.ne(JExpr._null()), fieldPathVar.eq(JExpr._null()).cor(fieldPathVar.invoke("isLeaf").not()) ); } }
@Override protected JExpression fromRawEntity(EntityDescriptionGenerator.CreateFromRawEntityHolder holder, PropertyMirror propertyMirror) { JExpression getEntityId = holder.rawEntity.invoke("getLong").arg(JExpr.lit(propertyMirror.getSafeName())); JExpression loadEntity = holder.torchFactory .invoke("begin") .invoke("load") .invoke("type").arg(CodeModelTypes.ref(propertyMirror).dotclass()) .invoke("id").arg(getEntityId); return JOp.cond(JOp.ne(getEntityId, JExpr._null()), loadEntity, JExpr._null()); }