org.reflections
Class Store

java.lang.Object
  extended by org.reflections.Store

public class Store
extends Object

stores metadata information in multimaps

use the different query methods (getXXX) to query the metadata

the query methods are string based, and does not cause the class loader to define the types

use Reflections.getStore() to access this store


Constructor Summary
protected Store()
           
protected Store(boolean concurrent)
           
 
Method Summary
protected  com.google.common.collect.ListMultimap<String,String> createMultimap()
           
 com.google.common.collect.Multimap<String,String> get(Class<? extends Scanner> scannerClass)
          return the multimap store of the given scanner class.
 Set<String> get(Class<? extends Scanner> scannerClass, Iterable<String> keys)
          get the values of given keys stored for the given scanner class
 Set<String> get(Class<? extends Scanner> scannerClass, String... keys)
          get the values of given keys stored for the given scanner class
 Set<String> getConstructorsAnnotatedWith(String annotation)
          get constructor names annotated with a given annotation
 Set<String> getFieldsAnnotatedWith(String annotation)
          get fields annotated with a given annotation
 Set<String> getInheritedSubTypes(Iterable<String> types, String annotation, boolean honorInherited)
          when honoring @Inherited, meta-annotation should only effect annotated super classes and it's sub types
 Integer getKeysCount()
          return the keys count
 Set<String> getMethodsAnnotatedWith(String annotation)
          get method names annotated with a given annotation
 com.google.common.collect.Multimap<String,String> getOrCreate(String indexName)
           
 Set<String> getResources(Pattern pattern)
          get resources relative paths where simple name (key) matches given regular expression
 Set<String> getResources(com.google.common.base.Predicate<String> namePredicate)
          get resources relative paths where simple name (key) matches given namePredicate
 Set<String> getResources(String key)
          get resources relative paths where simple name (key) equals given name
 Map<String,com.google.common.collect.Multimap<String,String>> getStoreMap()
          return the store map.
 Set<String> getSubTypesOf(String type)
          get sub types of a given type
 Set<String> getTypesAnnotatedWith(String annotation)
          get types annotated with a given annotation, both classes and annotations
 Set<String> getTypesAnnotatedWith(String annotation, boolean honorInherited)
          get types annotated with a given annotation, both classes and annotations
 Set<String> getTypesAnnotatedWithDirectly(String annotation)
          get types directly annotated with a given annotation, both classes and annotations
 Integer getValuesCount()
          return the values count
 boolean isAnnotation(String typeAnnotatedWith)
          is the given type is an annotation, based on the metadata stored by TypeAnnotationsScanner
 boolean isClass(String type)
          is the given type name a class.
 boolean isInheritedAnnotation(String typeAnnotatedWith)
          is the given annotation an inherited annotation, based on the metadata stored by TypeAnnotationsScanner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Store

protected Store()

Store

protected Store(boolean concurrent)
Method Detail

createMultimap

protected com.google.common.collect.ListMultimap<String,String> createMultimap()

getOrCreate

public com.google.common.collect.Multimap<String,String> getOrCreate(String indexName)

get

@Nullable
public com.google.common.collect.Multimap<String,String> get(Class<? extends Scanner> scannerClass)
return the multimap store of the given scanner class. not immutable


get

public Set<String> get(Class<? extends Scanner> scannerClass,
                       String... keys)
get the values of given keys stored for the given scanner class


get

public Set<String> get(Class<? extends Scanner> scannerClass,
                       Iterable<String> keys)
get the values of given keys stored for the given scanner class


getStoreMap

public Map<String,com.google.common.collect.Multimap<String,String>> getStoreMap()
return the store map. not immutable


getKeysCount

public Integer getKeysCount()
return the keys count


getValuesCount

public Integer getValuesCount()
return the values count


getSubTypesOf

public Set<String> getSubTypesOf(String type)
get sub types of a given type


getTypesAnnotatedWithDirectly

public Set<String> getTypesAnnotatedWithDirectly(String annotation)
get types directly annotated with a given annotation, both classes and annotations


getTypesAnnotatedWith

public Set<String> getTypesAnnotatedWith(String annotation)
get types annotated with a given annotation, both classes and annotations

Inherited is honored

Note that this (@Inherited) meta-annotation type has no effect if the annotated type is used for anything other than a class. Also, this meta-annotation causes annotations to be inherited only from superclasses; annotations on implemented interfaces have no effect.


getTypesAnnotatedWith

public Set<String> getTypesAnnotatedWith(String annotation,
                                         boolean honorInherited)
get types annotated with a given annotation, both classes and annotations

Inherited is honored according to given honorInherited

when honoring @Inherited, meta-annotation should only effect annotated super classes and it's sub types

when not honoring @Inherited, meta annotation effects all subtypes, including annotations interfaces and classes

Note that this (@Inherited) meta-annotation type has no effect if the annotated type is used for anything other than a class. Also, this meta-annotation causes annotations to be inherited only from superclasses; annotations on implemented interfaces have no effect.


getInheritedSubTypes

public Set<String> getInheritedSubTypes(Iterable<String> types,
                                        String annotation,
                                        boolean honorInherited)

when honoring @Inherited, meta-annotation should only effect annotated super classes and it's sub types

when not honoring @Inherited, meta annotation effects all subtypes, including annotations interfaces and classes


getMethodsAnnotatedWith

public Set<String> getMethodsAnnotatedWith(String annotation)
get method names annotated with a given annotation


getFieldsAnnotatedWith

public Set<String> getFieldsAnnotatedWith(String annotation)
get fields annotated with a given annotation


getConstructorsAnnotatedWith

public Set<String> getConstructorsAnnotatedWith(String annotation)
get constructor names annotated with a given annotation


getResources

public Set<String> getResources(String key)
get resources relative paths where simple name (key) equals given name


getResources

public Set<String> getResources(com.google.common.base.Predicate<String> namePredicate)
get resources relative paths where simple name (key) matches given namePredicate


getResources

public Set<String> getResources(Pattern pattern)
get resources relative paths where simple name (key) matches given regular expression
Set<String> xmls = reflections.getResources(".\*\.xml");


isClass

public boolean isClass(String type)
is the given type name a class.

causes class loading


isAnnotation

public boolean isAnnotation(String typeAnnotatedWith)
is the given type is an annotation, based on the metadata stored by TypeAnnotationsScanner


isInheritedAnnotation

public boolean isInheritedAnnotation(String typeAnnotatedWith)
is the given annotation an inherited annotation, based on the metadata stored by TypeAnnotationsScanner



Copyright © 2013. All Rights Reserved.