org.chromium.sdk/src/org/chromium/sdk/internal/protocolparser/JsonSubtypeCondition.java
equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
|
2 // Use of this source code is governed by a BSD-style license that can be |
|
3 // found in the LICENSE file. |
|
4 |
|
5 package org.chromium.sdk.internal.protocolparser; |
|
6 |
|
7 import java.lang.annotation.ElementType; |
|
8 import java.lang.annotation.Retention; |
|
9 import java.lang.annotation.RetentionPolicy; |
|
10 import java.lang.annotation.Target; |
|
11 |
|
12 /** |
|
13 * Specifies a condition for a field-reading method. It is one from group of annotations |
|
14 * that mark key fields for choosing particular subtype. They set conditions on JSON fields in |
|
15 * a subtype interface that drive subtype auto-selection at parsing time. |
|
16 * <p> |
|
17 * Specifies a general condition; it requires that: |
|
18 * <ul> |
|
19 * <li>field should be null, if {@link #valueIsNull()} is true, |
|
20 * <li>field should be absent, if {@link #fieldIsAbsent()} is true, |
|
21 * <li>field should exist, if no options are set. |
|
22 * </ul> |
|
23 */ |
|
24 @Target({ElementType.METHOD}) |
|
25 @Retention(RetentionPolicy.RUNTIME) |
|
26 public @interface JsonSubtypeCondition { |
|
27 boolean fieldIsAbsent() default false; |
|
28 boolean valueIsNull() default false; |
|
29 } |