private static <T> Argument<T> placeholderToArgument(T placeholder) { if (placeholder instanceof Argument) return (Argument<T>) placeholder; return (Argument<T>) (isLimitedValues(placeholder) ? LIMITED_VALUE_ARGUMENTS.get().getArgument(placeholder) : ARGUMENTS_BY_PLACEHOLDER.get(placeholder)); }
@SuppressWarnings("unchecked") static synchronized <T> T createArgument(Class<T> clazz, InvocationSequence invocationSequence) { T placeholder = (T) PLACEHOLDER_BY_INVOCATION.get(invocationSequence); if (placeholder == null) { placeholder = registerNewArgument(clazz, invocationSequence); } else if (isLimitedValues(placeholder)) { LIMITED_VALUE_ARGUMENTS .get() .setArgument( placeholder, new Argument<T>(LIMITED_VALUE_INVOCATIONS.get(invocationSequence))); } return placeholder; }
private static <T> void bindArgument(T placeholder, Argument<T> argument) { if (isLimitedValues(placeholder)) LIMITED_VALUE_ARGUMENTS.get().setArgument(placeholder, argument); else ARGUMENTS_BY_PLACEHOLDER.put(placeholder, argument); }