Ori Liel has posted comments on this change.
Change subject: restapi: List Possible Enum Values For Bad Input
......................................................................
Patch Set 1: (1 inline comment)
....................................................
File
backend/manager/modules/restapi/interface/common/jaxrs/src/main/java/org/ovirt/engine/api/common/util/EnumValidator.java
Line 73:
Line 74: private static <E extends Enum<E>> String
getPossibleValues(Class<E> clz) {
Line 75: StringBuilder builder = new StringBuilder(". Possible values
for " + clz.getSimpleName() + " are:");
Line 76: for (E enumValue : clz.getEnumConstants()) {
Line 77: builder.append("
").append(enumValue.name().toLowerCase()).append(",");
value() is a propietary method in our enums, the reflection code here gets a
generic enum <E extends Enum<E>>, so it only knows about basic enum methods.
name() is a built-in enum method, and together with .toLowerCase() it does
exactly the same thing that .value() does
Line 78: }
Line 79: return builder.toString().substring(0,
builder.toString().length() - 1);
Line 80: }
Line 81:
--
To view, visit http://gerrit.ovirt.org/7703
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I87c0d2cd125ac1f58684ce6b0cbd84e48746d138
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ori Liel <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Ori Liel <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches