View Javadoc

1   package com.atlassian.marketplace.client.encoding;
2   
3   /**
4    * Indicates that an object returned by the server (or constructed by the caller) was invalid
5    * because a field had a string value that was not one of its allowable values.
6    * @since 2.0.0
7    */
8   public class InvalidFieldValue extends SchemaViolation
9   {
10      private final String value;
11      
12      public InvalidFieldValue(String value, Class<?> valueClass)
13      {
14          super(valueClass);
15          this.value = value;
16      }
17      
18      @Override
19      public String getMessage()
20      {
21          return "\"" + value + "\" is not a valid value for " + getSchemaClass().getSimpleName();
22      }
23      
24      /**
25       * The specific string value that caused the error.
26       */
27      public String getValue()
28      {
29          return value;
30      }
31  }