Package org.instancio.internal.selectors
Class PrimitiveAndWrapperSelectorImpl
- java.lang.Object
-
- org.instancio.internal.selectors.PrimitiveAndWrapperSelectorImpl
-
- All Implemented Interfaces:
GroupableSelector
,Flattener
,Selector
,TargetSelector
,ToScopeConvertible
public final class PrimitiveAndWrapperSelectorImpl extends Object implements Selector, Flattener
-
-
Constructor Summary
Constructors Constructor Description PrimitiveAndWrapperSelectorImpl(Class<?> primitiveType, Class<?> wrapperType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<SelectorImpl>
flatten()
int
hashCode()
Scope
toScope()
Scope representation of a selector.String
toString()
Selector
within(Scope... scopes)
Specifies the scope for this selector in order to narrow down the selector target.
-
-
-
Method Detail
-
flatten
public List<SelectorImpl> flatten()
-
within
public Selector within(Scope... scopes)
Description copied from interface:Selector
Specifies the scope for this selector in order to narrow down the selector target.For example, if the
Person
class has twoPhone
fields:class Person { private Phone home; private Phone cell; // snip... }
and we want to set only the
cell
phone to a specific value, we can narrow down the selector as follows:Person person = Instancio.of(Person.class) .set(field(Phone.class, "number").within(scope(Person.class, "cell")), "123-45-67") .create();
Multiple scopes can be specified top-down, that is starting from the outermost class.
-
toScope
public Scope toScope()
Description copied from interface:ToScopeConvertible
Scope representation of a selector.- Specified by:
toScope
in interfaceToScopeConvertible
- Returns:
- scope
-
-