View Javadoc
1   /*
2    * Themis: Java Project Framework
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.themis.lethe.analysis;
18  
19  /**
20   * Modifiers.
21   */
22  public enum ThemisAnalysisModifier {
23      /**
24       * Private.
25       */
26      PRIVATE("private"),
27  
28      /**
29       * Protected.
30       */
31      PROTECTED("protected"),
32  
33      /**
34       * Public.
35       */
36      PUBLIC("public"),
37  
38      /**
39       * Static.
40       */
41      STATIC("static"),
42  
43      /**
44       * Final.
45       */
46      FINAL("final"),
47  
48      /**
49       * Abstract.
50       */
51      ABSTRACT("abstract"),
52  
53      /**
54       * Synchronized.
55       */
56      SYNCHRONIZED("synchronized"),
57  
58      /**
59       * DEFAULT.
60       */
61      DEFAULT("default"),
62  
63      /**
64       * Native.
65       */
66      NATIVE("native"),
67  
68      /**
69       * Volatile.
70       */
71      VOLATILE("volatile"),
72  
73      /**
74       * Transient.
75       */
76      TRANSIENT("transient");
77  
78      /**
79       * The modifier.
80       */
81      private final String theModifier;
82  
83      /**
84       * Constructor.
85       *
86       * @param pModifier the modifier
87       */
88      ThemisAnalysisModifier(final String pModifier) {
89          theModifier = pModifier;
90      }
91  
92      /**
93       * Obtain the modifier.
94       *
95       * @return the modifier
96       */
97      String getModifier() {
98          return theModifier;
99      }
100 
101     /**
102      * Obtain modifier for token.
103      *
104      * @param pToken the token
105      * @return the modifier (or null)
106      */
107     static ThemisAnalysisModifier findModifier(final String pToken) {
108         /* Loop through the modifiers */
109         for (ThemisAnalysisModifier myModifier : values()) {
110             /* If we found a modifier */
111             if (pToken.equals(myModifier.getModifier())) {
112                 return myModifier;
113             }
114         }
115 
116         /* Not found */
117         return null;
118     }
119 
120     @Override
121     public String toString() {
122         return getModifier();
123     }
124 }