feat: added set-via-descriptor-string for methods and fields

This commit is contained in:
zaaarf 2023-03-27 12:12:43 +02:00
parent 113d234bbf
commit f2d1394bc4
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C

View file

@ -171,6 +171,19 @@ public class MethodProxy extends AbstractProxy {
return this;
}
/**
* Sets the type of the method to the given descriptor,
* and extracts return and parameter types from it.
* @param descr the descriptor
* @return the builder's state after the change
*/
public Builder setDescriptor(String descr) {
super.setDescriptor(descr);
this.parameters.addAll(Arrays.asList(Type.getArgumentTypes(descr)));
this.returnType = Type.getReturnType(descr);
return this;
}
/**
* Builds a {@link MethodProxy} of the given kind.
* @return the built {@link MethodProxy}