/**
 * Copyright 2011-2012 Intellectual Reserve, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gedcomx.search;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

/**
 * The levels of confidence of a search result.
 *
 * @author Ryan Heaton
 */
@XmlType ( name = "ResultConfidence" )
@XmlEnum ( Integer.class )
public enum ResultConfidence {

  /**
   * Result confidence level 1 (lowest)
   */
  @XmlEnumValue("1")
  one,

  /**
   * Result confidence level 2.
   */
  @XmlEnumValue("2")
  two,

  /**
   * Result confidence level 3.
   */
  @XmlEnumValue("3")
  three,

  /**
   * Result confidence level 4.
   */
  @XmlEnumValue("4")
  four,

  /**
   * Result confidence level 5.
   */
  @XmlEnumValue("5")
  five

}

@@ -636,16 +636,219 @@
 earch;%0A%0A
+import org.codehaus.jackson.JsonParser;%0Aimport org.codehaus.jackson.annotate.JsonValue;%0Aimport org.codehaus.jackson.map.DeserializationContext;%0Aimport org.codehaus.jackson.map.annotate.JsonDeserialize;%0A%0A
 import j
@@ -969,16 +969,44 @@
 XmlType;
+%0Aimport java.io.IOException;
 %0A%0A/**%0A *
@@ -1147,16 +1147,95 @@
 class )%0A
+@JsonDeserialize (using = ResultConfidence.ResultConfidenceDeserializer.class)%0A
 public e
@@ -1303,16 +1303,17 @@
 (lowest)
+.
 %0A   */%0A 
@@ -1598,16 +1598,26 @@
  level 5
+ (highest)
 .%0A   */%0A
@@ -1643,12 +1643,942 @@
 )%0A  five
-%0A
+;%0A%0A  @JsonValue%0A  public Integer value() %7B%0A    switch(this) %7B%0A      case one:%0A        return 1;%0A      case two:%0A        return 2;%0A      case three:%0A        return 3;%0A      case four:%0A        return 4;%0A      case five:%0A        return 5;%0A      default:%0A        return null;%0A    %7D%0A  %7D%0A%0A  static class ResultConfidenceDeserializer extends org.codehaus.jackson.map.JsonDeserializer%3CResultConfidence%3E%0A  %7B%0A    @Override%0A    public ResultConfidence deserialize(final JsonParser parser, final DeserializationContext context) throws IOException%0A    %7B%0A      int i = parser.getIntValue();%0A      switch(i) %7B%0A        case 1:%0A          return ResultConfidence.one;%0A        case 2:%0A          return ResultConfidence.two;%0A        case 3:%0A          return ResultConfidence.three;%0A        case 4:%0A          return ResultConfidence.four;%0A        case 5:%0A          return ResultConfidence.five;%0A        default:%0A          return null;%0A      %7D%0A    %7D%0A  %7D
 %0A%7D%0A

Fix ResultConfidence to be an integer in JSON, rather than the string "one", "two"...