Package org.apache.felix.gogo.runtime
Class Reflective
- java.lang.Object
-
- org.apache.felix.gogo.runtime.Reflective
-
public final class Reflective extends Object
-
-
Constructor Summary
Constructors Constructor Description Reflective()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
coerce(CommandSession session, Class<?> type, Object arg, int[] convert)
converts given argument to specified type and increments convert[0] if any conversion was needed.static Object
invoke(CommandSession session, Object target, String name, List<Object> args)
invokes the named method on the given target using the supplied args, which are converted if necessary.
-
-
-
Field Detail
-
NO_MATCH
public static final Object NO_MATCH
-
MAIN
public static final String MAIN
- See Also:
- Constant Field Values
-
-
Method Detail
-
invoke
public static Object invoke(CommandSession session, Object target, String name, List<Object> args) throws Exception
invokes the named method on the given target using the supplied args, which are converted if necessary.- Returns:
- the result of the invoked method
- Throws:
Exception
-
coerce
public static Object coerce(CommandSession session, Class<?> type, Object arg, int[] convert)
converts given argument to specified type and increments convert[0] if any conversion was needed.- Parameters:
convert
- convert[0] is incremented according to the conversion needed, to allow the "best" conversion to be determined.- Returns:
- converted arg or NO_MATCH if no conversion possible.
-
-