summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-27 12:12:43 +0200
committer zaaarf <zaaarf@proton.me>2023-03-27 12:12:43 +0200
commitf2d1394bc425deabe22e845db9e097b63ebd2a2f (patch)
treeb2d37a2d232f55e12f777a5f92583381e554b8dd /src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java
parent113d234bbfb4879868bbe04c8088183bc05ae71e (diff)
feat: added set-via-descriptor-string for methods and fields
Diffstat (limited to 'src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java')
-rw-r--r--src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java b/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java
index 3710d36..a1306f7 100644
--- a/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java
+++ b/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java
@@ -172,6 +172,19 @@ public class MethodProxy extends AbstractProxy {
}
/**
+ * 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}
*/