public abstract class Lookup extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Lookup() |
protected |
Lookup(String name) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
capitalize(String string)
Capitalizes the first character of a String, leaves the rest alone.
|
String |
getName()
Provides a name for this Lookup, mostly for use in system logs.
|
abstract String |
nameFromFragments(List<String> fragments)
Assemble an attribute name that conforms to this Lookup's naming scheme from the provided list of name fragments.
|
abstract String |
valueFromName(String name,
Class singletonType)
Perform the actual lookup characteristic of this Lookup.
|
protected Lookup()
protected Lookup(String name)
public String getName()
public abstract String nameFromFragments(List<String> fragments)
fragments - This will be the camel-cased name of the method from your configuration interface, broken apart
into fragments. For example, "threadPoolSize" will become {"thread", "Pool", "Size"} and
"weatherServiceBaseURL" will become {"weather", "Service", "Base", "URL"}.public abstract String valueFromName(String name, Class singletonType)
name - The name of the value to look up, in this Lookup's naming scheme. For example, if the configuration
interface's method name is "threadPoolSize" and nameFromFragments converts that to "thread.pool.size,"
then this method will receive "thread.pool.size" as the name to look up.singletonType - This is the configuration interface that's being satisfied. Mostly you'll ignore this
parameter, but you might find it useful for composing error messages or logging.Copyright © 2017. All rights reserved.