org.springframework.core.type.filter

Class AbstractTypeHierarchyTraversingFilter

  • java.lang.Object
    • org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter
  • All Implemented Interfaces:
    TypeFilter
    Direct Known Subclasses:
    AnnotationTypeFilter, AssignableTypeFilter


    public abstract class AbstractTypeHierarchyTraversingFilter
    extends java.lang.Object
    implements TypeFilter
    Type filter that is aware of traversing over hierarchy.

    This filter is useful when matching needs to be made based on potentially the whole class/interface hierarchy. The algorithm employed uses a succeed-fast strategy: if at any time a match is declared, no further processing is carried out.

    Since:
    2.5
    Author:
    Ramnivas Laddad, Mark Fisher
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected Log logger 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
      Determine whether this filter matches for the class described by the given metadata.
      protected boolean matchClassName(java.lang.String className)
      Override this to match on type name.
      protected java.lang.Boolean matchInterface(java.lang.String interfaceName)
      Override this to match on interface type name.
      protected boolean matchSelf(MetadataReader metadataReader)
      Override this to match self characteristics alone.
      protected java.lang.Boolean matchSuperClass(java.lang.String superClassName)
      Override this to match on super type name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        protected final Log logger
    • Constructor Detail

      • AbstractTypeHierarchyTraversingFilter

        protected AbstractTypeHierarchyTraversingFilter(boolean considerInherited,
                                                        boolean considerInterfaces)
    • Method Detail

      • match

        public boolean match(MetadataReader metadataReader,
                             MetadataReaderFactory metadataReaderFactory)
                      throws java.io.IOException
        Description copied from interface: TypeFilter
        Determine whether this filter matches for the class described by the given metadata.
        Specified by:
        match in interface TypeFilter
        Parameters:
        metadataReader - the metadata reader for the target class
        metadataReaderFactory - a factory for obtaining metadata readers for other classes (such as superclasses and interfaces)
        Returns:
        whether this filter matches
        Throws:
        java.io.IOException - in case of I/O failure when reading metadata
      • matchSelf

        protected boolean matchSelf(MetadataReader metadataReader)
        Override this to match self characteristics alone. Typically, the implementation will use a visitor to extract information to perform matching.
      • matchClassName

        protected boolean matchClassName(java.lang.String className)
        Override this to match on type name.
      • matchSuperClass

        @Nullable
        protected java.lang.Boolean matchSuperClass(java.lang.String superClassName)
        Override this to match on super type name.
      • matchInterface

        @Nullable
        protected java.lang.Boolean matchInterface(java.lang.String interfaceName)
        Override this to match on interface type name.