< prev index next >

src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java

Print this page

        

@@ -81,11 +81,16 @@
 
     private static final Set<ElementKind> TYPE_KINDS =
         Collections.unmodifiableSet(EnumSet.of(ElementKind.CLASS,
                                                ElementKind.ENUM,
                                                ElementKind.INTERFACE,
+                                               ElementKind.RECORD,
                                                ElementKind.ANNOTATION_TYPE));
+
+    private static final Set<ElementKind> STATE_COMPONENT_KIND =
+        Set.of(ElementKind.STATE_COMPONENT);
+
     /**
      * Returns a list of fields in {@code elements}.
      * @return a list of fields in {@code elements}
      * @param elements the elements to filter
      */

@@ -102,10 +107,21 @@
     public static Set<VariableElement>
             fieldsIn(Set<? extends Element> elements) {
         return setFilter(elements, FIELD_KINDS, VariableElement.class);
     }
 
+    // Method below may only be temporary
+    /**
+     * Returns a list of state descriptions in {@code elements}.
+     * @return a list of state descriptions in {@code elements}
+     * @param elements the elements to filter
+     */
+    public static List<VariableElement>
+        stateComponentsIn(List<? extends Element> elements) {
+        return listFilter(elements, STATE_COMPONENT_KIND, VariableElement.class);
+    }
+
     /**
      * Returns a list of constructors in {@code elements}.
      * @return a list of constructors in {@code elements}
      * @param elements the elements to filter
      */
< prev index next >