ObjenesisObjenesisSerializer, ObjenesisStdpublic class ObjenesisBase extends Object implements Objenesis
| Modifier and Type | Field | Description |
|---|---|---|
protected ConcurrentHashMap<String,ObjectInstantiator<?>> |
cache |
Strategy cache.
|
protected InstantiatorStrategy |
strategy |
Strategy used by this Objenesis implementation to create classes
|
| Constructor | Description |
|---|---|
ObjenesisBase(InstantiatorStrategy strategy) |
Constructor allowing to pick a strategy and using cache
|
ObjenesisBase(InstantiatorStrategy strategy,
boolean useCache) |
Flexible constructor allowing to pick the strategy and if caching should be used
|
| Modifier and Type | Method | Description |
|---|---|---|
<T> ObjectInstantiator<T> |
getInstantiatorOf(Class<T> clazz) |
Will pick the best instantiator for the provided class.
|
<T> T |
newInstance(Class<T> clazz) |
Will create a new object without any constructor being called
|
String |
toString() |
protected final InstantiatorStrategy strategy
protected ConcurrentHashMap<String,ObjectInstantiator<?>> cache
public ObjenesisBase(InstantiatorStrategy strategy)
strategy - Strategy to usepublic ObjenesisBase(InstantiatorStrategy strategy, boolean useCache)
strategy - Strategy to useuseCache - If ObjectInstantiators should be cachedpublic <T> T newInstance(Class<T> clazz)
newInstance in interface ObjenesisT - Type instantiatedclazz - Class to instantiatepublic <T> ObjectInstantiator<T> getInstantiatorOf(Class<T> clazz)
newInstance(Class).getInstantiatorOf in interface ObjenesisT - Type to instantiateclazz - Class to instantiateCopyright © 2006–2018 Joe Walnes, Henri Tremblay, Leonardo Mesquita. All rights reserved.