Record Class ExtensionFilter
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.configuration.ExtensionFilter
- Record Components:
filterStrategy- theExtensionFilter.FilterStrategyto useclasses- the names of base packages of theClasses to filter according to the usedExtensionFilter.FilterStrategy
- All Implemented Interfaces:
Predicate<ServiceLoader.Provider<Extension>>
public record ExtensionFilter(ExtensionFilter.FilterStrategy filterStrategy, Collection<String> classes)
extends Record
implements Predicate<ServiceLoader.Provider<Extension>>
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe two available filter strategies -
Constructor Summary
ConstructorsConstructorDescriptionExtensionFilter(ExtensionFilter.FilterStrategy filterStrategy, Collection<String> classes) Creates an instance of aExtensionFilterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionclasses()Returns the value of theclassesrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefilterStrategyrecord component.final inthashCode()Returns a hash code value for this object.booleantest(ServiceLoader.Provider<Extension> provider) Tests whether anExtensionshould be used or not according to this filter.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ExtensionFilter
Creates an instance of aExtensionFilterrecord class.- Parameters:
filterStrategy- the value for thefilterStrategyrecord componentclasses- the value for theclassesrecord component
-
-
Method Details
-
test
Tests whether anExtensionshould be used or not according to this filter. The- Specified by:
testin interfacePredicate<ServiceLoader.Provider<Extension>>- Parameters:
provider- the 'unloaded'Extensionto test (still wrapped byServiceLoader.Provider)- Returns:
- whether to use the extension
- Implementation Note:
- This method compares the
fully classified class nameof theExtensionimplementation toclasses()by usingString.startsWith(String), so it's possible to include/exclude an extensions by only using a part of the full name/packages.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
filterStrategy
Returns the value of thefilterStrategyrecord component.- Returns:
- the value of the
filterStrategyrecord component
-
classes
-