Use contains() rather than indexOf() here. Or better still, overload the validate method to take two PrimitiveTypeName arguments (not varargs), so that each call doesn't have to allocate a List. This is in the read path so it's probably worth avoiding object allocations where possible.