public final JExpression ne(JExpression right) { return JOp.ne(this, right); }
public final JExpression ne(JExpression right) { return JOp.ne(this, right); }
public final JExpression ne(JExpression right) { return JOp.ne(this, right); }
public final JExpression ne(JExpression right) { return JOp.ne(this, right); }
public final JExpression ne(JExpression right) { return JOp.ne(this, right); }
@Override public JExpression wrapCondifiton(JExpression source) { return JOp.ne(source, JExpr._null()); }
public JExpression hasSetValue() { return JOp.ne(field, JExpr._null()); }
@Override public JExpression wrapCondifiton(JExpression source) { return JOp.ne(source, JExpr._null()); }
public JExpression hasSetValue() { return JOp.ne(field, JExpr._null()); }
@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 JStatement validate(final DatabindableDatatype datatype, final JCodeModel codeModel, final JDefinedClass theClass, final JExpression value, final JAssignmentTarget problem) { final JBlock block = newBlock(); final JExpression signum = value.invoke("signum"); final JConditional ifRangeViolated = block._if(JOp.ne(signum, JExpr.lit(1))); ifRangeViolated._then().assign(problem, JExpr._new(codeModel.ref(NonPositiveProblem.class)).arg(value)); return block; } }
public JStatement validate(final DatabindableDatatype datatype, final JCodeModel codeModel, final JDefinedClass theClass, final JExpression value, final JAssignmentTarget problem) { final JBlock block = newBlock(); final JExpression signum = value.invoke("signum"); final JConditional ifRangeViolated = block._if(JOp.ne(signum, JExpr.lit(-1))); ifRangeViolated._then().assign(problem, JExpr._new(codeModel.ref(org.jvnet.jaxbvalidation.problem.datatype.NonNegativeProblem.class)).arg(value)); return block; } }
@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()); }
final JMethod childSetter = AccessorUtils.set(childClassContext, childFieldItem); final JFieldRef value = JExpr.ref("value"); setter.body()._if(JOp.ne(value, JExpr._null()))._then().invoke(value, childSetter).arg(JExpr._this()); unsetter.body()._if(JOp.ne(value, JExpr._null()))._then().invoke(value, childSetter).arg(JExpr._null());
ifValuesNotEqual._then()._return(JExpr.FALSE); } else if (value.type().isPrimitive()) { final JConditional ifValuesNotEqual = block._if(JOp.ne(value, targetValue)); ifValuesNotEqual._then()._return(JExpr.FALSE); } else if (value.type() == codeModel.ref(Calendar.class)) { final JConditional ifValuesNotEqual = block._if(JOp.not(JOp.cor(JOp .eq(value, targetValue), JOp.cand(JOp.ne(value, JExpr._null()), final JConditional ifValuesNotEqual = block._if(JOp.not(JOp.cor( JOp.eq(value, targetValue), JOp.cand(JOp.ne(value, JExpr._null()), final JConditional ifValuesNotEqual = block._if(JOp.not(JOp.cor( JOp.eq(value, targetValue), JOp.cand(JOp.ne(value, JExpr._null()), value.invoke("equals").arg(targetValue))))); ifValuesNotEqual._then()._return(JExpr.FALSE);
final JVar draftValue = check.param(Object.class, "draftValue"); final JBlock body = check.body(); final JConditional ifNotNull = body._if(JOp.ne(draftValue, JExpr._null()));
block.add(vc.validate(guard, codeModel, theClass, value, problem)); final JConditional ifProblemIsNotNull = block._if(JOp.ne( JExpr._null(), problem)); ifProblemIsNotNull._then().directStatement(
final JConditional ifValuesNotEqual = block._if(JOp.ne(value, targetValue)); ifValuesNotEqual._then()._return(JExpr.FALSE); final JConditional ifValuesNotEqual = block._if(JOp.not(JOp.cor( JOp.eq(value, targetValue), JOp.cand(JOp.ne(value, JExpr._null()), final JConditional ifValuesNotEqual = block._if(JOp.not(JOp.cor( JOp.eq(value, targetValue), JOp.cand(JOp.ne(value, JExpr._null()),
/** * Override the getMessage class on an exception to make sure the * status code is displayed * @param $exception */ protected void overrideMessageOnException(JDefinedClass $exception) { JClass $responseClass = codeModel.ref(Response.class); // Create a new version of getMessage, adding on the reason phrase // if it is a standard message JMethod $getMessage = $exception.method(JMod.PUBLIC, String.class, "getMessage"); $getMessage.javadoc().append("Workaround for JAX_RS_SPEC-312"); JBlock $body = $getMessage.body(); JVar $response = $body.decl($responseClass, "response", JExpr.invoke("getResponse")); JClass $statusClass = codeModel.ref(Response.Status.class); JVar $status = $body.decl( $statusClass, "status", $statusClass.staticInvoke("fromStatusCode") .arg($response.invoke("getStatus"))); JConditional $if = $body._if(JOp.ne($status, JExpr._null())); $if._then()._return( JOp.plus($response.invoke("getStatus"), JOp.plus(JExpr.lit(" "),$status.invoke("getReasonPhrase")))); $if._else()._return( codeModel.ref(Integer.class).staticInvoke("toString") .arg( $response.invoke("getStatus"))); }
protected JStatement generateCheckStatement( final ClassContext classContext, final FieldItem fieldItem, final JDefinedClass theClass, final JExpression locator, final JExpression handler, final JExpression values, final JType type) { final JCodeModel codeModel = getCodeModel(classContext); final FieldUse fieldUse = getFieldUse(classContext, fieldItem); final JMethod entryCheck = generateCollectionValueEntryCheck(classContext, fieldItem, theClass); final JBlock block = JBlock.dummyInstance.block(); final JConditional ifNotNull = block._if(JOp.ne(values, JExpr._null())); final JForLoop _for = ifNotNull._then()._for(); final JVar index = _for.init(codeModel.INT, "index", JExpr.lit(0)); _for.test(JOp.lt(index, values.invoke("size"))); _for.update(JOp.incr(index)); final JType objectClass = codeModel.ref(Object.class); final JVar item = _for.body().decl(objectClass, "item", JExpr.invoke(values, "get").arg(index)); // final JVar collectionLocator = _for.body().decl( // codeModel.ref(IObjectLocator.class), // "collectionLocator", // JExpr._new(codeModel.ref(FieldObjectLocator.class)).arg(locator).arg(master).arg( // JExpr.lit(fieldUse.name))); _for.body().invoke(entryCheck).arg(locator).arg(handler).arg(index).arg(item); return block; }