@SuppressWarnings("unchecked") public static <T> T notInstanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (!actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must not be an instance of type %s.", parameterName, type.getCanonicalName() ) ); }
@SuppressWarnings("unchecked") public static <T> T instanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must be an instance of type %s.", parameterName, type.getCanonicalName() ) ); } @SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") public static <T> T instanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must be an instance of type %s.", parameterName, type.getCanonicalName() ) ); } @SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") public static <T> T notInstanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (!actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must not be an instance of type %s.", parameterName, type.getCanonicalName() ) ); }
@SuppressWarnings("unchecked") public static <T> T notInstanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (!actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must not be an instance of type %s.", parameterName, type.getCanonicalName() ) ); }
@SuppressWarnings("unchecked") public static <T> T instanceOf(final Class<T> type, final Object value, final String parameterName) { final Class<?> actualType = getBoxedType(VerifyArgument.notNull(type, "type")); if (actualType.isInstance(value)) { return (T) value; } throw new IllegalArgumentException( format( "Argument '%s' must be an instance of type %s.", parameterName, type.getCanonicalName() ) ); } @SuppressWarnings("unchecked")