Package org.instancio
Interface TypeSelectorBuilder
- All Superinterfaces:
DepthPredicateSelector
,DepthSelector
,GroupableSelector
,TargetSelector
public interface TypeSelectorBuilder
extends GroupableSelector, DepthSelector, DepthPredicateSelector
A builder for constructing predicate-based type selectors.
An instance of the builder can be obtained using Select.types()
.
Other methods from this class can be chained to form logical AND
relationships, for example:
types().of(BaseEntity.class).annotated(Entity.class).annotated(Table.class)
will match BaseEntity
including its subtypes, that are annotated with
@Entity
and @Table
.
- Since:
- 1.6.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
TypeSelectorBuilderMatches types annotated with the specified annotation, ignoring inherited annotations.atDepth
(int depth) Restricts this selector's target(s) to the specified depth.Restricts this selector's target(s) to a depth that satisfies the givenpredicate
.Excludes specified class from matching.Matches specified type, including subtypes.
-
Method Details
-
of
Matches specified type, including subtypes. For example, selecting typesof(Collection.class
} will matchList
,Set
, etc.- Parameters:
type
- to match- Returns:
- selector builder
- Since:
- 1.6.0
-
annotated
Matches types annotated with the specified annotation, ignoring inherited annotations.Note: this method only matches annotations declared on classes. To select annotated fields, use
FieldSelectorBuilder.annotated(Class)
.The method can be chained to require multiple annotations.
- Type Parameters:
A
- annotation type- Parameters:
annotation
- declared annotation to match- Returns:
- selector builder
- Since:
- 1.6.0
-
excluding
Excludes specified class from matching.The method can be chained to exclude multiple types.
- Parameters:
type
- type to exclude- Returns:
- selector builder
- Since:
- 1.6.0
-
atDepth
Restricts this selector's target(s) to the specified depth.When a selector
atDepth(N)
is convertedtoScope()
, the semantics ofSelector.within(Scope...)
method still hold, meaning: at depth equal to or greater thanN
.- Specified by:
atDepth
in interfaceDepthSelector
- Parameters:
depth
- the depth at which selector applies- Returns:
- selector restricted to the specified depth
- Since:
- 2.14.0
-
atDepth
Restricts this selector's target(s) to a depth that satisfies the givenpredicate
.- Specified by:
atDepth
in interfaceDepthPredicateSelector
- Parameters:
atDepth
- specifying the depth- Returns:
- selector restricted to the specified depth
- Since:
- 2.14.0
-