Package org.instancio

Interface TypeSelectorBuilder

All Superinterfaces:
TargetSelector
All Known Implementing Classes:
TypeSelectorBuilderImpl

public interface TypeSelectorBuilder extends TargetSelector
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 Details

    • of

      Matches specified type, including subtypes. For example, selecting types of(Collection.class} will match List, Set, etc.
      Parameters:
      type - to match
      Returns:
      selector builder
      Since:
      1.6.0
    • annotated

      <A extends Annotation> TypeSelectorBuilder annotated(Class<? extends A> annotation)
      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

      TypeSelectorBuilder excluding(Class<?> type)
      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