code: public String validateEnumValue(char[] cbuf, int start, int end,
                                      boolean normalize,
                                      WordResolver res)
      {
          /* Better NOT to build temporary Strings quite yet; can resolve
           * matches via resolver more efficiently.
           */
          // Note: at this point, should only have real spaces...
          if (normalize) {
              while (start < end && cbuf[start] <= CHAR_SPACE) {
                  ++start;
              }
              while (--end > start && cbuf[end] <= CHAR_SPACE) {
                  ;
              }
              ++end; // so it'll point to the first char (or beyond end of buffer)
          }
  
          // Empty String is never legal for enums:
          if (start >= end) {
              return null;
          }
          return res.find(cbuf, start, end);
      }
docs: Method called by validation/normalization code for enumeration-valued
  attributes, to trim
  specified attribute value (full normalization not needed -- called
  for values that CAN NOT have spaces inside; such values can not
  be legal), and then check whether it is included
  in set of words (tokens) passed in. If actual value was included,
  will return the normalized word (as well as store shared String
  locally); otherwise will return null.