Package eu.tneitzel.rmg.internal
Class MethodArguments
- java.lang.Object
-
- eu.tneitzel.rmg.internal.MethodArguments
-
public class MethodArguments extends Object implements Iterable<Pair<Object,Class>>, Iterator<Pair<Object,Class>>
Internally, Java RMI always uses an array of objects as argument for method calls. During the marshalling, reflective access to the corresponding remote method is used to determine the correct marshalling type. Primitive types are marshalled by their corresponding write function (e.g. writeInt for the int type), whereas non primitive types are usually marshalled with writeObject (except of String, that uses writeString). Within rmg, we do not use the high level RMI API and implemented low level RMI calls manually (well, we still use RMI library functions and only implemented the actual dispatching manually). This allows to call remote methods in different ways that it is usually done. E.g. it is no longer required that the corresponding Method object actually exists and methods can be called directly by specifying their hash value. However, the correct marshalling of call arguments is still required and if the corresponding remote method does not exist within the current scope, it is required to pass the desired argument types in a different way. For this purpose, we use the MethodArguments class, that stores method arguments together with their desired marshalling type. When creating a MethodArguments object, you currently need to pass the expected capacity for the argument array. This was a design decision, to allow storing method arguments within the most simple data structure. Previously, we used LinkedHashMap to store arguments, which caused troubles as deserialization gadgets triggered when putting them into the map.- Author:
- Tobias Neitzel (@qtc_de)
-
-
Constructor Summary
Constructors Constructor Description MethodArguments(int capacity)MethodArguments(Object argumentObject, Class argumentClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Object argumentObject, Class argumentClass)booleanhasNext()Iterator<Pair<Object,Class>>iterator()Pair<Object,Class>next()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-