OverrideMethodpublic final class OverrideMethod extends Object Allows stub methods from LayoutLib to be overriden at runtime.
Implementation note: all types required by this class(inner/outer classes & interfaces)
must be referenced by the injectClass argument to {@link AsmGenerator} in Main.java;
Otherwise they won't be accessible in layoutlib.jar at runtime. |
Fields Summary |
---|
private static HashMap | sMethodsMap of method overridden. | private static MethodListener | sDefaultListenerDefault listener for all method not listed in sMethods. Nothing if null. |
Methods Summary |
---|
public static java.lang.Object | invokeA(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the object return type.
MethodListener i = sMethods.get(signature);
if (i != null) {
return i.onInvokeA(signature, isNative, caller);
} else if (sDefaultListener != null) {
return sDefaultListener.onInvokeA(signature, isNative, caller);
}
return null;
| public static double | invokeD(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the double return type.
MethodListener i = sMethods.get(signature);
if (i != null) {
return i.onInvokeD(signature, isNative, caller);
} else if (sDefaultListener != null) {
return sDefaultListener.onInvokeD(signature, isNative, caller);
}
return 0;
| public static float | invokeF(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the float return type.
MethodListener i = sMethods.get(signature);
if (i != null) {
return i.onInvokeF(signature, isNative, caller);
} else if (sDefaultListener != null) {
return sDefaultListener.onInvokeF(signature, isNative, caller);
}
return 0;
| public static int | invokeI(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the int return type.
MethodListener i = sMethods.get(signature);
if (i != null) {
return i.onInvokeI(signature, isNative, caller);
} else if (sDefaultListener != null) {
return sDefaultListener.onInvokeI(signature, isNative, caller);
}
return 0;
| public static long | invokeL(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the long return type.
MethodListener i = sMethods.get(signature);
if (i != null) {
return i.onInvokeL(signature, isNative, caller);
} else if (sDefaultListener != null) {
return sDefaultListener.onInvokeL(signature, isNative, caller);
}
return 0;
| public static void | invokeV(java.lang.String signature, boolean isNative, java.lang.Object caller)Invokes the specific listener for the given signature or the default one if defined.
This version invokes the method listener for the void return type.
Note: this is not intended to be used by the LayoutLib Bridge. It is intended to be called
by the stubbed methods generated by the LayoutLib_create tool.
MethodListener i = sMethods.get(signature);
if (i != null) {
i.onInvokeV(signature, isNative, caller);
} else if (sDefaultListener != null) {
sDefaultListener.onInvokeV(signature, isNative, caller);
}
| public static void | setDefaultListener(MethodListener listener)Sets the default listener for all methods not specifically handled.
Null means to do nothing.
sDefaultListener = listener;
| public static void | setMethodListener(java.lang.String signature, MethodListener listener)Defines or reset a listener for the given method signature.
if (listener == null) {
sMethods.remove(signature);
} else {
sMethods.put(signature, listener);
}
|
|