Interface FieldFilter

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface FieldFilter
Functional interface for filtering fields during cloning 克隆过程中过滤字段的函数式接口

Determines which fields should be included in the deep clone process. Provides factory methods for common filtering patterns and supports composition via and(FieldFilter), or(FieldFilter), and negate().

决定哪些字段应包含在深度克隆过程中。提供常见过滤模式的工厂方法, 并支持通过 and(FieldFilter)or(FieldFilter)negate() 进行组合。

Since:
JDK 25, opencode-base-deepclone V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(Field field)
    Tests whether the given field should be included in cloning 测试给定字段是否应包含在克隆中
    Creates a filter that accepts all fields 创建接受所有字段的过滤器
    default FieldFilter
    Returns a composed filter that represents a logical AND 返回表示逻辑AND的组合过滤器
    excludeAnnotated(Class<? extends Annotation> annotationType)
    Creates a filter that excludes fields annotated with the given annotation 创建排除具有指定注解字段的过滤器
    excludeNames(String... names)
    Creates a filter that excludes fields with the given names 创建排除指定名称字段的过滤器
    excludeTypes(Class<?>... types)
    Creates a filter that excludes fields of the given types 创建排除指定类型字段的过滤器
    includeNames(String... names)
    Creates a filter that only includes fields with the given names 创建仅包含指定名称字段的过滤器
    default FieldFilter
    Returns a filter that represents the logical negation 返回表示逻辑取反的过滤器
    default FieldFilter
    or(FieldFilter other)
    Returns a composed filter that represents a logical OR 返回表示逻辑OR的组合过滤器
  • Method Details

    • accept

      boolean accept(Field field)
      Tests whether the given field should be included in cloning 测试给定字段是否应包含在克隆中
      Parameters:
      field - the field to test | 要测试的字段
      Returns:
      true if the field should be cloned | 如果字段应被克隆返回true
    • acceptAll

      static FieldFilter acceptAll()
      Creates a filter that accepts all fields 创建接受所有字段的过滤器
      Returns:
      a filter that always returns true | 总是返回true的过滤器
    • excludeNames

      static FieldFilter excludeNames(String... names)
      Creates a filter that excludes fields with the given names 创建排除指定名称字段的过滤器
      Parameters:
      names - the field names to exclude | 要排除的字段名
      Returns:
      the filter | 过滤器
    • includeNames

      static FieldFilter includeNames(String... names)
      Creates a filter that only includes fields with the given names 创建仅包含指定名称字段的过滤器
      Parameters:
      names - the field names to include | 要包含的字段名
      Returns:
      the filter | 过滤器
    • excludeTypes

      static FieldFilter excludeTypes(Class<?>... types)
      Creates a filter that excludes fields of the given types 创建排除指定类型字段的过滤器
      Parameters:
      types - the field types to exclude | 要排除的字段类型
      Returns:
      the filter | 过滤器
    • excludeAnnotated

      static FieldFilter excludeAnnotated(Class<? extends Annotation> annotationType)
      Creates a filter that excludes fields annotated with the given annotation 创建排除具有指定注解字段的过滤器
      Parameters:
      annotationType - the annotation type | 注解类型
      Returns:
      the filter | 过滤器
    • and

      default FieldFilter and(FieldFilter other)
      Returns a composed filter that represents a logical AND 返回表示逻辑AND的组合过滤器
      Parameters:
      other - the other filter | 另一个过滤器
      Returns:
      the composed filter | 组合过滤器
    • or

      default FieldFilter or(FieldFilter other)
      Returns a composed filter that represents a logical OR 返回表示逻辑OR的组合过滤器
      Parameters:
      other - the other filter | 另一个过滤器
      Returns:
      the composed filter | 组合过滤器
    • negate

      default FieldFilter negate()
      Returns a filter that represents the logical negation 返回表示逻辑取反的过滤器
      Returns:
      the negated filter | 取反过滤器