public class ClassBindings extends Object
LoremIpsumObjectCreator which specific
implementation it should use to produce new dummy instances for a certain type. This is most useful to make sure Dummy Creator can create
dummy objects for interface / abstract types it encounters.
Deferred types are produced by LoremIpsumObjectFactory implementations. Default factories are in place for strings, primitives, enums. In
addition,there are factories that can be configured to invoke a specific Method (MethodBasedFactory) or a specific
Constructor (ConstructorBasedFactory). Finally, there is a factory to return a fixed instance. The
ClassBasedFactory is used automatically internally if no class binding can be found for a particular type. Examples are:
| Constructor and Description |
|---|
ClassBindings()
Initializes with basic bindings for primitives, arrays and strings.
|
| Modifier and Type | Method and Description |
|---|---|
<T> void |
bind(Class<T> clazz,
LoremIpsumObjectFactory<? extends T> factory)
Binds a
LoremIpsumObjectFactory to a specific Class instance. |
<T> @Nullable LoremIpsumObjectFactory<T> |
find(Class<T> _class)
This method returns a binding made for the given class.
|
public ClassBindings()
public <T> void bind(Class<T> clazz, LoremIpsumObjectFactory<? extends T> factory)
LoremIpsumObjectFactory to a specific Class instance.clazz - The class to bind the dummy factory to.factory - The factory to bind the the given class.IllegalArgumentException - Thrown if LoremIpsumObjectFactory.isValidForType(Class) returns false or throws an
IllegalArgumentException itself.LoremIpsumObjectFactory.isValidForType(Class)@Nullable public <T> @Nullable LoremIpsumObjectFactory<T> find(Class<T> _class)
Copyright © 2019–2020. All rights reserved.