Class Jadice
java.lang.Object
com.levigo.jadice.document.config.Jadice
Helper methods for object creation and configuration. The methods supplied by this class are
mainly used by jadice components internally; however, they can be helpful in a few advanced
integration scenarios.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Apply all registered and applicableComponentConfigurer
s to an object.static <C> C
Create a new instance of the given type and apply theComponentConfigurer
s pertaining to it.static org.jadice.util.base.Resolver
<Class<?>, ClassNotFoundException> Gets theResolver
to be used by jadice components when looking upClass
instances based on their name.static void
Remove all registeredComponentConfigurer
instances.static void
setClassResolver
(org.jadice.util.base.Resolver<Class<?>, ClassNotFoundException> resolver) Set theResolver
to be used by jadice compontents when looking upClass
instances based on their name.
-
Method Details
-
purgeComponentConfigurers
public static void purgeComponentConfigurers()Remove all registeredComponentConfigurer
instances. -
create
Create a new instance of the given type and apply theComponentConfigurer
s pertaining to it.- Parameters:
componentClass
- the class to be instantiated- Returns:
- a new instance of the requested type, readily configured.
- Throws:
IllegalArgumentException
- if instantiation is not possible due to various reasons, such as Illegal Access or a non-instantiable kind of class
-
configure
Apply all registered and applicableComponentConfigurer
s to an object. AComponentConfigurer
is applicable if the type of object which it is able to configure matches the given instance's type.- Parameters:
instance
- the object to be configured
-
getClassResolver
Gets theResolver
to be used by jadice components when looking upClass
instances based on their name.- Returns:
- the
Resolver
to be used by jadice components when looking upClass
instances based on their name.
-
setClassResolver
public static void setClassResolver(org.jadice.util.base.Resolver<Class<?>, ClassNotFoundException> resolver) Set theResolver
to be used by jadice compontents when looking upClass
instances based on their name. Setting a custom resolver is only needed in very few advanced integration scenarios.- Parameters:
resolver
- theResolver
to be used from now on
-