diff options
author | zaaarf <zaaarf@proton.me> | 2023-03-21 16:32:19 +0100 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-03-21 16:32:19 +0100 |
commit | 884cefead9e4fede7243650afc4f22f08f8e5090 (patch) | |
tree | 9a63d0638238f67ef6d3ed3379a0c63c76e03e75 /src/main/java/ftbsc/lll/proxies/FieldProxy.java | |
parent | 40686b8c929279bd486529fceae1d8dd7fa2735f (diff) |
feat: expanded ClassProxies, now all fields and methods include classproxies to represent their parents (as well as parameters and return type for methods)
Diffstat (limited to 'src/main/java/ftbsc/lll/proxies/FieldProxy.java')
-rw-r--r-- | src/main/java/ftbsc/lll/proxies/FieldProxy.java | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/main/java/ftbsc/lll/proxies/FieldProxy.java b/src/main/java/ftbsc/lll/proxies/FieldProxy.java index 72a4e40..8855cd8 100644 --- a/src/main/java/ftbsc/lll/proxies/FieldProxy.java +++ b/src/main/java/ftbsc/lll/proxies/FieldProxy.java @@ -16,7 +16,7 @@ public class FieldProxy extends AbstractProxy { * @param f the {@link Field} object corresponding to this. */ public FieldProxy(Field f) { - super(f.getName(), Type.getType(f.getType()), f.getModifiers(), Type.getInternalName(f.getDeclaringClass())); + super(f.getName(), Type.getType(f.getType()), f.getModifiers(), ClassProxy.from(f.getDeclaringClass())); } /** @@ -24,9 +24,9 @@ public class FieldProxy extends AbstractProxy { * @param name the name of the field * @param type the {@link Type} of the field * @param modifiers the modifiers of the field - * @param parent the FQN of the parent class of the field + * @param parent the {@link QualifiableProxy} for the parent */ - protected FieldProxy(String name, Type type, int modifiers, String parent) { + protected FieldProxy(String name, Type type, int modifiers, QualifiableProxy parent) { super(name, type, modifiers, parent); } @@ -40,6 +40,16 @@ public class FieldProxy extends AbstractProxy { } /** + * Indicates whether the given object is a proxy for the same element as this. + * @param obj the object to perform + * @return true if it's equal + */ + @Override + public boolean equals(Object obj) { + return obj instanceof FieldProxy && super.equals(obj); + } + + /** * A builder object for {@link FieldProxy}. */ public static class Builder extends AbstractProxy.Builder<FieldProxy> { @@ -52,6 +62,27 @@ public class FieldProxy extends AbstractProxy { } /** + * Sets the parent class of this field to the one described by the + * fully qualified name and with the given modifiers. + * @param parentFQN the fully qualified name of the parent + * @return the builder's state after the change + */ + public Builder setParent(String parentFQN, int modifiers) { + super.setParent(ClassProxy.from(parentFQN, 0, modifiers)); + return this; + } + + /** + * Sets the parent class of this field to the one described by the + * fully qualified name. + * @param parentFQN the fully qualified name of the parent + * @return the builder's state after the change + */ + public Builder setParent(String parentFQN) { + return this.setParent(parentFQN, 0); + } + + /** * Builds a {@link FieldProxy} of the given kind. * @return the built {@link FieldProxy} */ |