4

I'd guess as opposed to but I'm not sure.

This property must be set as opposed to X (one or another, not both)

How can this can be better?

6 Answers6

6

You don't want as opposed to here: A as opposed to B means A (only), not B.

There are several ways of saying what you want; one may be more graceful than another in a particular context, but any of them will work:

Either [this property] must be set, or [property X], but not both.
You must set either [this property] or [property X], but not both.
You must set exactly one of [this property] and [property X].
Set one, but not both, of [this property] and [property X].
Select one property to set: [this property] or [property X].

3

I don't think "as opposed to" does what you want here. Instead of "one or the other, but not both," it means "this one, not that one."

How about: The property must be set as either X or Y. ("Either" suggests that the "or" isn't inclusive.)

3

Properties X and Y are mutually exclusive.

Jim
  • 33,381
  • Careful. The meaning doesn't match the original. The question refers to two distinct properties (with no mention of their values), not a single binary property. – quietmint Aug 30 '12 at 14:13
  • You are correct, I got caught up in some other interpretations here. I have corrected it. – Jim Aug 30 '12 at 14:31
2

X or Y must be set but not both

is short and unambiguous.

  • Careful. The meaning doesn't match the original. The question refers to two distinct properties (with no mention of their values), not a single binary property. – quietmint Aug 30 '12 at 14:13
  • I hold that it isn't the same at all. Compare "Your dessert may be ice cream or cake" (enumerating possible values for one property) with "You may have either an appetizer or a dessert" (separate properties that are mutually exclusive, with no mention of the possible values). – quietmint Aug 31 '12 at 01:12
0

If neither property is required, then consider phrasing it in the negative:

You may not set both [property X] and [property Y].

For clarity, also consider including the result of ignoring this requirement:

Attempting to set both properties will result in an IllegalStateException.

-or-

The most recently set property takes precedence.

quietmint
  • 210
0

If I understand your question correctly, "Set only one: A or B," would be clear and simple.

Mike
  • 679