/** * Register a custom argument creator factory for an unknown final class * * @param clazz The class for which this factory should be used * @param creator The argument factory * @param <T> */ public static <T> void registerFinalClassArgumentCreator( Class<T> clazz, FinalClassArgumentCreator<T> creator) { if ((clazz.getModifiers() & Modifier.FINAL) == 0) throw new RuntimeException( "A custom argument creator can be registered only for final classes"); FINAL_CLASS_ARGUMENT_CREATORS.put(clazz, creator); }
private static Object createPlaceholder(Class<?> clazz, InvocationSequence invocationSequence) { return !Modifier.isFinal(clazz.getModifiers()) ? createProxy(new ProxyArgument(clazz, invocationSequence), clazz, false) : createArgumentPlaceholder(clazz); }