def withValues(cls, *values):
        """Creates a subclass with discreet values constraint.
        """

        class X(cls):
            subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint(
                *values)

        X.__name__ = cls.__name__
        return X