final OrderedByStatement declared) {
// Aggressively reuse effective instances which are backed by the corresponding empty declared instance, as this
// is the case unless there is a weird extension in use.
- final String argument = declared.getValue();
- switch (argument) {
- case "system":
- if (EMPTY_SYSTEM_DECL.equals(declared)) {
- return EMPTY_SYSTEM_EFF;
- }
- break;
- case "user":
- if (EMPTY_USER_DECL.equals(declared)) {
- return EMPTY_USER_EFF;
- }
- break;
- default:
- throw new IllegalStateException("Unhandled argument " + argument);
+ if (EMPTY_USER_DECL.equals(declared)) {
+ // Most likely to be seen (as system is the default)
+ return EMPTY_USER_EFF;
+ } else if (EMPTY_SYSTEM_DECL.equals(declared)) {
+ return EMPTY_SYSTEM_EFF;
+ } else {
+ return new EmptyOrderedByEffectiveStatement(declared);
}
-
- // Declared instance was non-empty, which can happen with extensions
- return new EmptyOrderedByEffectiveStatement(declared);
}
}