public interface JavaConfigurationBuilder extends ConfigurationBuilder
In addition to being less verbose, this interface expresses many of Tang's type checks in Java's generic type system. This improves IDE auto-completion. It also allows the errors to be caught at compile time instead of later on in the build process, or at runtime.
Modifier and Type | Method and Description |
---|---|
<T> JavaConfigurationBuilder |
bind(Class<T> iface,
Class<?> impl)
Bind named parameters, implementations or external constructors, depending
on the types of the classes passed in.
|
<T> JavaConfigurationBuilder |
bindConstructor(Class<T> c,
Class<? extends ExternalConstructor<? extends T>> v) |
<T> JavaConfigurationBuilder |
bindImplementation(Class<T> iface,
Class<? extends T> impl)
Binds the Class impl as the implementation of the interface iface.
|
<T> JavaConfigurationBuilder |
bindList(Class<? extends Name<List<T>>> iface,
List impl)
Binds a specific list to a named parameter.
|
JavaConfigurationBuilder |
bindNamedParameter(Class<? extends Name<?>> name,
String value)
Set the value of a named parameter.
|
<T> JavaConfigurationBuilder |
bindNamedParameter(Class<? extends Name<T>> iface,
Class<? extends T> impl) |
<T> JavaConfigurationBuilder |
bindSetEntry(Class<? extends Name<Set<T>>> iface,
Class<? extends T> impl) |
<T> JavaConfigurationBuilder |
bindSetEntry(Class<? extends Name<Set<T>>> iface,
String value) |
addConfiguration, bind, bind, bindConstructor, bindList, bindList, bindSetEntry, bindSetEntry, bindSetEntry, bindSetEntry, build, classPrettyDefaultString, classPrettyDescriptionString, getClassHierarchy, registerLegacyConstructor, registerLegacyConstructor, registerLegacyConstructor
<T> JavaConfigurationBuilder bind(Class<T> iface, Class<?> impl) throws BindException
T
- a typeiface
- an interface classimpl
- an implementation classBindException
<T> JavaConfigurationBuilder bindImplementation(Class<T> iface, Class<? extends T> impl) throws BindException
T
- a typeiface
- an interface classimpl
- an implementation classBindException
JavaConfigurationBuilder bindNamedParameter(Class<? extends Name<?>> name, String value) throws BindException
name
- The dummy class that serves as the name of this parameter.value
- A string representing the value of the parameter. Reef must know
how to parse the parameter's type.NameResolutionException
- which occurs when name resolution failsBindException
<T> JavaConfigurationBuilder bindNamedParameter(Class<? extends Name<T>> iface, Class<? extends T> impl) throws BindException
BindException
<T> JavaConfigurationBuilder bindConstructor(Class<T> c, Class<? extends ExternalConstructor<? extends T>> v) throws BindException
BindException
<T> JavaConfigurationBuilder bindSetEntry(Class<? extends Name<Set<T>>> iface, String value) throws BindException
BindException
<T> JavaConfigurationBuilder bindSetEntry(Class<? extends Name<Set<T>>> iface, Class<? extends T> impl) throws BindException
BindException
<T> JavaConfigurationBuilder bindList(Class<? extends Name<List<T>>> iface, List impl) throws BindException
T
- A typeiface
- The target named parameter to be injected intoimpl
- A concrete listBindException
- It occurs when iface is not a named parameter or impl is not compatible to bindCopyright © 2017 The Apache Software Foundation. All rights reserved.