View Javadoc
1   /*
2    * #%L
3    * RedactOption.java - mongodb-async-driver - Allanbank Consulting, Inc.
4    * %%
5    * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  
21  package com.allanbank.mongodb.builder;
22  
23  /**
24   * RedactOption provides options for what to do when evaluating a
25   * {@code $redact} condition within the {@link Aggregate} pipeline.
26   * 
27   * @copyright 2014, Allanbank Consulting, Inc., All Rights Reserved
28   */
29  public enum RedactOption {
30      /**
31       * Option for the redact to descend into the sub-documents of the current
32       * document.
33       */
34      DESCEND("$$DESCEND"),
35  
36      /** Option to keep the current document and not inspect the sub-documents. */
37      KEEP("$$KEEP"),
38  
39      /** Option to prune the current document. */
40      PRUNE("$$PRUNE");
41  
42      /** The token for the option. */
43      private final String myToken;
44  
45      /**
46       * Creates a new RedactOption.
47       * 
48       * @param token
49       *            The token for the option.
50       */
51      private RedactOption(final String token) {
52          myToken = token;
53      }
54  
55      /**
56       * Returns the token for the option.
57       * 
58       * @return The token for the option.
59       */
60      public String getToken() {
61          return myToken;
62      }
63  }