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.
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 TypeMethodDescriptionbooleanTests whether the given field should be included in cloning 测试给定字段是否应包含在克隆中static FieldFilterCreates a filter that accepts all fields 创建接受所有字段的过滤器default FieldFilterand(FieldFilter other) Returns a composed filter that represents a logical AND 返回表示逻辑AND的组合过滤器static FieldFilterexcludeAnnotated(Class<? extends Annotation> annotationType) Creates a filter that excludes fields annotated with the given annotation 创建排除具有指定注解字段的过滤器static FieldFilterexcludeNames(String... names) Creates a filter that excludes fields with the given names 创建排除指定名称字段的过滤器static FieldFilterexcludeTypes(Class<?>... types) Creates a filter that excludes fields of the given types 创建排除指定类型字段的过滤器static FieldFilterincludeNames(String... names) Creates a filter that only includes fields with the given names 创建仅包含指定名称字段的过滤器default FieldFilternegate()Returns a filter that represents the logical negation 返回表示逻辑取反的过滤器default FieldFilteror(FieldFilter other) Returns a composed filter that represents a logical OR 返回表示逻辑OR的组合过滤器
-
Method Details
-
accept
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
Creates a filter that accepts all fields 创建接受所有字段的过滤器- Returns:
- a filter that always returns true | 总是返回true的过滤器
-
excludeNames
Creates a filter that excludes fields with the given names 创建排除指定名称字段的过滤器- Parameters:
names- the field names to exclude | 要排除的字段名- Returns:
- the filter | 过滤器
-
includeNames
Creates a filter that only includes fields with the given names 创建仅包含指定名称字段的过滤器- Parameters:
names- the field names to include | 要包含的字段名- Returns:
- the filter | 过滤器
-
excludeTypes
Creates a filter that excludes fields of the given types 创建排除指定类型字段的过滤器- Parameters:
types- the field types to exclude | 要排除的字段类型- Returns:
- the filter | 过滤器
-
excludeAnnotated
Creates a filter that excludes fields annotated with the given annotation 创建排除具有指定注解字段的过滤器- Parameters:
annotationType- the annotation type | 注解类型- Returns:
- the filter | 过滤器
-
and
Returns a composed filter that represents a logical AND 返回表示逻辑AND的组合过滤器- Parameters:
other- the other filter | 另一个过滤器- Returns:
- the composed filter | 组合过滤器
-
or
Returns a composed filter that represents a logical OR 返回表示逻辑OR的组合过滤器- Parameters:
other- the other filter | 另一个过滤器- Returns:
- the composed filter | 组合过滤器
-
negate
Returns a filter that represents the logical negation 返回表示逻辑取反的过滤器- Returns:
- the negated filter | 取反过滤器
-