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?
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI'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?
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].
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.)
Properties X and Y are mutually exclusive.
X or Y must be set but not both
is short and unambiguous.
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.
If I understand your question correctly, "Set only one: A or B," would be clear and simple.