/** * Returns true if the method has the specified signature. */ public boolean hasSignature(JType[] argTypes) { JVar[] p = listParams(); if (p.length != argTypes.length) return false; for (int i = 0; i < p.length; i++) if (!p[i].type().equals(argTypes[i])) return false; return true; }
/** * Returns true if the method has the specified signature. */ public boolean hasSignature(JType[] argTypes) { JVar[] p = listParams(); if (p.length != argTypes.length) return false; for (int i = 0; i < p.length; i++) if (!p[i].type().equals(argTypes[i])) return false; return true; }
/** * Returns true if the method has the specified signature. */ public boolean hasSignature(JType[] argTypes) { JVar[] p = listParams(); if (p.length != argTypes.length) return false; for (int i = 0; i < p.length; i++) if (!p[i].type().equals(argTypes[i])) return false; return true; }
/** * Returns true if the method has the specified signature. */ public boolean hasSignature(JType[] argTypes) { JVar[] p = listParams(); if (p.length != argTypes.length) return false; for (int i = 0; i < p.length; i++) if (!p[i].type().equals(argTypes[i])) return false; return true; }
protected void annotateParamsWithNotNull( @Nonnull JMethod method ) { for ( JVar param : method.listParams() ) { param.annotate( notNullAnnotationType ); } } }
/** * Returns true if the method has the specified signature. */ public boolean hasSignature(JType[] argTypes) { JVar[] p = listParams(); if (p.length != argTypes.length) return false; for (int i = 0; i < p.length; i++) if (!p[i].type().equals(argTypes[i])) return false; return true; }
private void setParameter(JClass newType, JMethod jMethod) { if (jMethod != null) { JVar jVar = jMethod.listParams()[0]; jVar.type(newType); } }
protected void finishConstructor( @Nonnull JDefinedClass serializerClass, @Nonnull JMethod constructor ) { if ( constructor.listParams().length > 0 ) { constructor.body().directStatement( "assert getDelegatesMappings().verify();" ); } }
@Nonnull @Override protected Map<FieldWithInitializationInfo, JVar> fillDeSerializationMethods( @Nonnull DomainObjectDescriptor domainObjectDescriptor, @Nonnull JDefinedClass serializerClass, @Nonnull JMethod serializeMethod, @Nonnull JMethod deserializeMethod ) { try { return super.fillDeSerializationMethods( domainObjectDescriptor, serializerClass, serializeMethod, deserializeMethod ); } finally { //Call closeTag( deserializeFrom ); on deserialize JVar deserializeFrom = deserializeMethod.listParams()[0]; deserializeMethod.body().directStatement( "//Finally closing element" ); deserializeMethod.body().invoke( StaxMateGenerator.METHOD_NAME_CLOSE_TAG ).arg( deserializeFrom ); } }
private JExpression constructorExpression(JMethod method, JClass type) { JExpression initExpr; if (type.isAbstract()) { JInvocation invocation = CLASS_MAP.get(PrismForJAXBUtil.class).staticInvoke(METHOD_PRISM_UTIL_CREATE_TARGET_INSTANCE); invocation.arg(method.listParams()[0]); initExpr = invocation; } else { initExpr = JExpr._new(type); } return initExpr; }
private void createFieldReferenceWillClear(JFieldVar field, JMethod method) { JBlock body = method.body(); JInvocation getObject = JExpr.invoke(method.listParams()[0], "getObject"); body._return(getObject.eq(JExpr._null())); }
private void createFieldReferenceUseWillClear(JFieldVar field, JMethod method) { JBlock body = method.body(); JInvocation getObject = JExpr.invoke(method.listParams()[0], "getObject"); body._return(getObject.ne(JExpr._null())); }
private void createFieldReferenceCreateItemBody(JFieldVar field, JMethod method) { JClass type = ((JClass) field.type()).getTypeParameters().get(0); JBlock body = method.body(); JExpression initExpr; initExpr = constructorExpression(method, type); JVar decl = body.decl(type, field.name(), initExpr); JInvocation invocation = body.invoke(decl, METHOD_SETUP_REFERENCE_VALUE); invocation.arg(method.listParams()[0]); body._return(decl); }
private void createFieldContainerCreateItemBody(JFieldVar field, JMethod method) { JClass list = (JClass) field.type(); JClass listType = list.getTypeParameters().get(0); JBlock body = method.body(); JVar decl = body.decl(listType, field.name(), constructorExpression(method, listType)); JInvocation invocation = body.invoke(decl, METHOD_SETUP_CONTAINER_VALUE); invocation.arg(method.listParams()[0]); body._return(decl); }
private void createFieldSetterBody(JMethod method, JFieldVar field) { JBlock body = method.body(); JInvocation invocation = body.staticInvoke(CLASS_MAP.get(PrismForJAXBUtil.class), METHOD_PRISM_UTIL_SET_PROPERTY_VALUE); //push arguments invocation.arg(JExpr.invoke(METHOD_AS_PRISM_CONTAINER_VALUE)); invocation.arg(JExpr.ref(fieldFPrefixUnderscoredUpperCase(field.name()))); invocation.arg(method.listParams()[0]); }
private void createFieldReferenceUseCreateItemBody(JFieldVar field, JMethod method) { JClass type = ((JClass) field.type()).getTypeParameters().get(0); JBlock body = method.body(); JExpression initExpr; initExpr = constructorExpression(method, type); JVar decl = body.decl(type, field.name(), initExpr); JInvocation invocation = body.invoke(decl, METHOD_SETUP_CONTAINER); invocation.arg(JExpr.invoke(method.listParams()[0], "getObject")); body._return(decl); }
private boolean updateIdField(JFieldVar field, ClassOutline classOutline) { JMethod method = recreateGetter(field, classOutline); JBlock body = method.body(); body._return(JExpr.invoke(JExpr.invoke(METHOD_AS_PRISM_CONTAINER_VALUE), "getId")); method = recreateSetter(field, classOutline); body = method.body(); JInvocation invocation = body.invoke(JExpr.invoke(METHOD_AS_PRISM_CONTAINER_VALUE), "setId"); invocation.arg(method.listParams()[0]); return true; }
private void updateObjectReferenceResolutionTime(JDefinedClass definedClass, JMethod getReference) { JFieldVar typeField = definedClass.fields().get("resolutionTime"); JMethod getType = recreateMethod(findMethod(definedClass, "getResolutionTime"), definedClass); copyAnnotations(getType, typeField); JBlock body = getType.body(); body._return(JExpr.invoke(JExpr.invoke(getReference), "getResolutionTime")); definedClass.removeField(typeField); JMethod setType = recreateMethod(findMethod(definedClass, "setResolutionTime"), definedClass); body = setType.body(); JInvocation invocation = body.invoke(JExpr.invoke(getReference), "setResolutionTime"); invocation.arg(setType.listParams()[0]); }
private void updateObjectReferenceOid(JDefinedClass definedClass, JMethod getReference) { JFieldVar oidField = definedClass.fields().get("oid"); JMethod getOid = recreateMethod(findMethod(definedClass, "getOid"), definedClass); copyAnnotations(getOid, oidField); definedClass.removeField(oidField); JBlock body = getOid.body(); body._return(JExpr.invoke(JExpr.invoke(getReference), getOid.name())); JMethod setOid = recreateMethod(findMethod(definedClass, "setOid"), definedClass); body = setOid.body(); JInvocation invocation = body.invoke(JExpr.invoke(getReference), setOid.name()); invocation.arg(setOid.listParams()[0]); }
private void updateObjectReferenceDescription(JDefinedClass definedClass, JMethod getReference) { JFieldVar descriptionField = definedClass.fields().get("description"); JMethod getDescription = recreateMethod(findMethod(definedClass, "getDescription"), definedClass); copyAnnotations(getDescription, descriptionField); definedClass.removeField(descriptionField); JBlock body = getDescription.body(); body._return(JExpr.invoke(JExpr.invoke(getReference), getDescription.name())); JMethod setDescription = recreateMethod(findMethod(definedClass, "setDescription"), definedClass); body = setDescription.body(); JInvocation invocation = body.invoke(JExpr.invoke(getReference), setDescription.name()); invocation.arg(setDescription.listParams()[0]); }