View Javadoc

1   package com.atlassian.marketplace.client.encoding;
2   
3   import static com.google.common.base.Preconditions.checkNotNull;
4   
5   /**
6    * Indicates that an object returned by the server (or constructed by the caller) was invalid
7    * because a required field was omitted.
8    * @since 2.0.0
9    */
10  public class MissingRequiredField extends SchemaViolation
11  {
12      private final String name;
13      
14      public MissingRequiredField(Class<?> schemaClass, String name)
15      {
16          super(schemaClass);
17          this.name = checkNotNull(name);
18      }
19      
20      /**
21       * The name of the field that was not found.
22       */
23      public String getName()
24      {
25          return name;
26      }
27      
28      @Override
29      public String getMessage()
30      {
31          return "missing required property \"" + name + "\" in " + getSchemaClass().getSimpleName();
32      }
33  }