private void updateGetterSetterJavaDoc(JDefinedClass jclass, List<String> requiredFieldMethods) { for (Iterator<JMethod> methods = jclass.methods().iterator(); methods.hasNext();) { JMethod method = methods.next(); if (requiredFieldMethods.contains(method.name())) { addJavaDoc(method); } } }
private void addOverrideBuilders(JDefinedClass jclass, JDefinedClass parentJclass) { if (parentJclass == null) { return; } for (JMethod parentJMethod : parentJclass.methods()) { if (parentJMethod.name().startsWith("with") && parentJMethod.params().size() == 1) { addOverrideBuilder(jclass, parentJMethod, parentJMethod.params().get(0)); } } }
private static void processMethodCollectionForSerializableSupport(Iterator<JMethod> methods, DataOutputStream dataOutputStream) throws IOException { TreeMap<String, JMethod> sortedMethods = new TreeMap<>(); while (methods.hasNext()) { JMethod method = methods.next(); //Collect non-private methods if ((method.mods().getValue() & JMod.PRIVATE) != JMod.PRIVATE) { sortedMethods.put(method.name(), method); } } for (JMethod method : sortedMethods.values()) { dataOutputStream.writeUTF(method.name()); dataOutputStream.writeInt(method.mods().getValue()); if (method.type() != null) { dataOutputStream.writeUTF(method.type().fullName()); } for (JVar param : method.params()) { dataOutputStream.writeUTF(param.type().fullName()); } } }
private void addOverrideBuilder(JDefinedClass thisJDefinedClass, JMethod parentBuilder, JVar parentParam) { if (thisJDefinedClass.getMethod(parentBuilder.name(), new JType[] {parentParam.type()}) == null) { JMethod builder = thisJDefinedClass.method(parentBuilder.mods().getValue(), thisJDefinedClass, parentBuilder.name()); builder.annotate(Override.class); JVar param = builder.param(parentParam.type(), parentParam.name()); JBlock body = builder.body(); body.invoke(JExpr._super(), parentBuilder).arg(param); body._return(JExpr._this()); } } }
/** * Returns the name of this <code>JavaMethod</code>. * * @return the <code>String</code> name of this <code>JavaMethod</code>. */ public String getName() { return xjcMethod.name(); }
/** * Returns the name of this <code>JavaConstructor</code>. * * @return the <code>String</code> name of this <code>JavaConstructor</code>. */ public String getName() { return xjcConstructor.name(); }
public static JMethod getMethod(final JDefinedClass theClass, final String name) { for (Iterator iterator = theClass.methods(); iterator.hasNext();) { final JMethod method = (JMethod) iterator.next(); if (method.name().equals(name)) return method; } return null; }
public static JMethod getMethod(final JDefinedClass theClass, final String name) { for (JMethod method : theClass.methods()) { if (method.name().equals(name)) return method; } return null; }
public static JMethod getMethod(final JDefinedClass theClass, final String name) { for (JMethod method : theClass.methods()) { if (method.name().equals(name)) return method; } return null; }
public static JMethod getMethod(final JDefinedClass theClass, final String name) { for (JMethod method : theClass.methods()) { if (method.name().equals(name)) return method; } return null; }
public static JMethod getMethod(final JDefinedClass theClass, final String name) { for (JMethod method : theClass.methods()) { if (method.name().equals(name)) return method; } return null; }
private void removeCloneableMethod(ClassOutline classOutline) { JDefinedClass impl = classOutline.implClass; Iterator<JMethod> methods = impl.methods().iterator(); while (methods.hasNext()) { JMethod method = methods.next(); if ("clone".equals(method.name()) && method.hasSignature(new JType[]{})) { methods.remove(); } } }
private void updateGetterSetterJavaDoc(JDefinedClass jclass, List<String> requiredFieldMethods) { for (Iterator<JMethod> methods = jclass.methods().iterator(); methods.hasNext();) { JMethod method = methods.next(); if (requiredFieldMethods.contains(method.name())) { addJavaDoc(method); } } }
private JMethod findMethod(JDefinedClass definedClass, String methodName) { for (JMethod method : definedClass.methods()) { if (method.name().equals(methodName)) { return method; } } throw new IllegalArgumentException("Couldn't find method '" + methodName + "' in defined class '" + definedClass.name() + "'"); }
private void addOverrideBuilders(JDefinedClass jclass, JDefinedClass parentJclass) { if (parentJclass == null) { return; } for (JMethod parentJMethod : parentJclass.methods()) { if (parentJMethod.name().startsWith("with") && parentJMethod.params().size() == 1) { addOverrideBuilder(jclass, parentJMethod, parentJMethod.params().get(0)); } } }
public boolean hasGetter() { for (final JMethod method : this.fieldOutline.parent().implClass.methods()) { if ((method.name().equals("get" + this.fieldOutline.getPropertyInfo().getName(true)) || method.name().equals("is" + this.fieldOutline.getPropertyInfo().getName(true))) && method.params().isEmpty()) { return true; } } return false; }
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]); }
private void addOverrideBuilder(JDefinedClass thisJDefinedClass, JMethod parentBuilder, JVar parentParam) { if (thisJDefinedClass.getMethod(parentBuilder.name(), new JType[] {parentParam.type()}) == null) { JMethod builder = thisJDefinedClass.method(parentBuilder.mods().getValue(), thisJDefinedClass, parentBuilder.name()); builder.annotate(Override.class); JVar param = builder.param(parentParam.type(), parentParam.name()); JBlock body = builder.body(); body.invoke(JExpr._super(), parentBuilder).arg(param); body._return(JExpr._this()); } } }
private void createReferenceStringVersionOidType(JFieldVar field, ClassOutline classOutline, JMethod originalMethod, JType objectReferenceType) { JMethod newMethod = classOutline.implClass.method(JMod.PUBLIC, originalMethod.type(), originalMethod.name()); JVar oid = newMethod.param(String.class, "oid"); JVar type = newMethod.param(QName.class, "type"); JBlock body = newMethod.body(); JVar refVal = body.decl(CLASS_MAP.get(PrismReferenceValue.class), "refVal", JExpr._new(CLASS_MAP.get(PrismReferenceValueImpl.class)) .arg(oid).arg(type)); JVar ort = body.decl(objectReferenceType, "ort", JExpr._new(objectReferenceType)); body.invoke(ort, METHOD_SETUP_REFERENCE_VALUE).arg(refVal); body._return(JExpr.invoke(originalMethod).arg(ort)); }