Class VisibilityFilter


  • public final class VisibilityFilter
    extends Object
    This class is used as filter for properties discovery. It uses java modifiers to check if a property (can be a method, field, constructor or any class that implements Member interface) is visible.

    The filter acts by excluding the properties with specified modifiers. Here are some examples :

     // will filter nothing :
     new VisibilityFilter();
    
     // exclude only private and transient:
     new VisibilityFilter(Modifier.TRANSIENT, Modifier.PRIVATE);
    
     // exclude only public!! and allow all the rest
     new VisibilityFilter(Modifier.public);
     

    So the idea is to pass to the constructor all the Modifier.XXX modifiers that you want to be filtered.

    Author:
    Eugen Cepoi
    See Also:
    BeanMutatorAccessorResolver.StandardMutaAccessorResolver
    • Constructor Detail

      • VisibilityFilter

        public VisibilityFilter​(int... modifier)
        Creates a new VisibilityFilter with specified modifiers. You must use existing values from Modifier class otherwise an exception will be thrown.
        Parameters:
        modifier - all the modifiers you want to exclude.
    • Method Detail

      • isVisible

        public final boolean isVisible​(Member member)
        Checks whether this member is visible or not according to this filter.
        Parameters:
        member -
        Returns:
        true if this member is visible according to this filter.
      • isVisible

        public final boolean isVisible​(int modifiers)