Class ObjectStreamClassPredicate
- java.lang.Object
-
- org.apache.commons.io.serialization.ObjectStreamClassPredicate
-
- All Implemented Interfaces:
java.util.function.Predicate<java.io.ObjectStreamClass>
public class ObjectStreamClassPredicate extends java.lang.Object implements java.util.function.Predicate<java.io.ObjectStreamClass>
A predicate (boolean-valued function) of one argument to accept and reject classes.The reject list takes precedence over the accept list.
- Since:
- 2.18.0
-
-
Constructor Summary
Constructors Constructor Description ObjectStreamClassPredicate()Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectStreamClassPredicateaccept(java.lang.Class<?>... classes)Accepts the specified classes for deserialization, unless they are otherwise rejected.ObjectStreamClassPredicateaccept(java.lang.String... patterns)Accepts the wildcard specified classes for deserialization, unless they are otherwise rejected.ObjectStreamClassPredicateaccept(java.util.regex.Pattern pattern)Accepts class names that match the supplied pattern for deserialization, unless they are otherwise rejected.ObjectStreamClassPredicateaccept(ClassNameMatcher matcher)Accepts class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.ObjectStreamClassPredicatereject(java.lang.Class<?>... classes)Rejects the specified classes for deserialization, even if they are otherwise accepted.ObjectStreamClassPredicatereject(java.lang.String... patterns)Rejects the wildcard specified classes for deserialization, even if they are otherwise accepted.ObjectStreamClassPredicatereject(java.util.regex.Pattern pattern)Rejects class names that match the supplied pattern for deserialization, even if they are otherwise accepted.ObjectStreamClassPredicatereject(ClassNameMatcher m)Rejects class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.booleantest(java.io.ObjectStreamClass objectStreamClass)Tests that the ObjectStreamClass conforms to requirements.booleantest(java.lang.String name)Tests that the class name conforms to requirements.
-
-
-
Constructor Detail
-
ObjectStreamClassPredicate
public ObjectStreamClassPredicate()
Constructs a new instance.
-
-
Method Detail
-
accept
public ObjectStreamClassPredicate accept(java.lang.Class<?>... classes)
Accepts the specified classes for deserialization, unless they are otherwise rejected.The reject list takes precedence over the accept list.
- Parameters:
classes- Classes to accept- Returns:
- this object
-
accept
public ObjectStreamClassPredicate accept(ClassNameMatcher matcher)
Accepts class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.The reject list takes precedence over the accept list.
- Parameters:
matcher- a class name matcher to accept objects.- Returns:
thisinstance.
-
accept
public ObjectStreamClassPredicate accept(java.util.regex.Pattern pattern)
Accepts class names that match the supplied pattern for deserialization, unless they are otherwise rejected.The reject list takes precedence over the accept list.
- Parameters:
pattern- a Pattern for compiled regular expression.- Returns:
thisinstance.
-
accept
public ObjectStreamClassPredicate accept(java.lang.String... patterns)
Accepts the wildcard specified classes for deserialization, unless they are otherwise rejected.The reject list takes precedence over the accept list.
- Parameters:
patterns- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch- Returns:
thisinstance.
-
reject
public ObjectStreamClassPredicate reject(java.lang.Class<?>... classes)
Rejects the specified classes for deserialization, even if they are otherwise accepted.The reject list takes precedence over the accept list.
- Parameters:
classes- Classes to reject- Returns:
thisinstance.
-
reject
public ObjectStreamClassPredicate reject(ClassNameMatcher m)
Rejects class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.The reject list takes precedence over the accept list.
- Parameters:
m- the matcher to use- Returns:
thisinstance.
-
reject
public ObjectStreamClassPredicate reject(java.util.regex.Pattern pattern)
Rejects class names that match the supplied pattern for deserialization, even if they are otherwise accepted.The reject list takes precedence over the accept list.
- Parameters:
pattern- standard Java regexp- Returns:
thisinstance.
-
reject
public ObjectStreamClassPredicate reject(java.lang.String... patterns)
Rejects the wildcard specified classes for deserialization, even if they are otherwise accepted.The reject list takes precedence over the accept list.
- Parameters:
patterns- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch- Returns:
thisinstance.
-
test
public boolean test(java.io.ObjectStreamClass objectStreamClass)
Tests that the ObjectStreamClass conforms to requirements.The reject list takes precedence over the accept list.
- Specified by:
testin interfacejava.util.function.Predicate<java.io.ObjectStreamClass>- Parameters:
objectStreamClass- The ObjectStreamClass to test.- Returns:
- true if the input is accepted, false if rejected, false if neither.
-
test
public boolean test(java.lang.String name)
Tests that the class name conforms to requirements.The reject list takes precedence over the accept list.
- Parameters:
name- The class name to test.- Returns:
- true if the input is accepted, false if rejected, false if neither.
-
-