Skip to content

io microsphere filter Filter

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

Filter

Type: Interface | Module: microsphere-java-core | Package: io.microsphere.filter | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/filter/Filter.java

Overview

The Filter interface represents a generic filtering mechanism that can be applied to objects of type T.

Implementations of this interface define the logic to determine whether a given object should be accepted or filtered out. This interface is typically used in scenarios where conditional processing or selection of objects is required.

Example Usage

`public class EvenNumberFilter implements Filter {
    public boolean accept(Integer number) {
        return number % 2 == 0;
    `
}

// Usage
Filter filter = new EvenNumberFilter();
System.out.println(filter.accept(4));  // Output: true
System.out.println(filter.accept(5));  // Output: false
}

Declaration

public interface Filter<T> extends Predicate<T>

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

public class EvenNumberFilter implements Filter<Integer> {
    public boolean accept(Integer number) {
        return number % 2 == 0;
    }
}

// Usage
Filter<Integer> filter = new EvenNumberFilter();
System.out.println(filter.accept(4));  // Output: true
System.out.println(filter.accept(5));  // Output: false

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.filter.Filter;

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally