code: private IndexType getIndexTypeFromString(String indexTypeAsString)
      {
          IndexType indexType;
  
          try
          {
              indexType = IndexType.findByValue(new Integer(indexTypeAsString));
          }
          catch (NumberFormatException e)
          {
              try
              {
                  // if this is not an integer lets try to get IndexType by name
                  indexType = IndexType.valueOf(indexTypeAsString);
              }
              catch (IllegalArgumentException ie)
              {
                  throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.", ie);
              }
          }
  
          if (indexType == null)
          {
              throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.");
          }
  
          return indexType;
      }
docs: Getting IndexType object from indexType string
  @param indexTypeAsString - string return by parser corresponding to IndexType
  @return IndexType - an IndexType object