public class ClasspathConnector extends AbstractConnector
Default Charset "UTF-8" is used to read the content from Classpath.
Modifier | Constructor and Description |
---|---|
|
ClasspathConnector()
Default Constructor (e.g. use in settings4j.xml).
|
protected |
ClasspathConnector(ClasspathContentResolver classpathContentResolver)
protected Constructor for extensions and Unit-Tests.
|
Modifier and Type | Method and Description |
---|---|
String |
getCharset() |
byte[] |
getContent(String key)
return a byte[]-Value for the given key or
null if no file-content for the key where found. |
protected ContentResolver |
getContentResolver() |
Object |
getObject(String key)
return a Object-Value for the given key.
|
String |
getString(String key)
return a String-Value for the given key.
|
void |
setCharset(String charset) |
void |
setContentResolver(ContentResolver contentResolver)
set a ContentResolver as Helper for
Connector.getContent(String) . |
addConnector, getConnectors, getName, getObjectResolver, init, setName, setObjectResolver
public ClasspathConnector()
protected ClasspathConnector(ClasspathContentResolver classpathContentResolver)
classpathContentResolver
- ClasspathContentResolver
public byte[] getContent(String key)
Connector
null
if no file-content for the key where found.
The concrete implementation can use the ContentResolver if required
key
- the Key for the configuration-property. e.g.: "com/mycompany/myapp/myParameterKey"public Object getObject(String key)
Connector
The concrete implementation can use the ObjectResolver if required
key
- the Key for the configuration-property. e.g.: "com/mycompany/myapp/myParameterKey"public String getString(String key)
Connector
key
- the Key for the configuration-property. e.g.: "com/mycompany/myapp/myParameterKey"public String getCharset()
public void setCharset(String charset)
charset
- a valid Charset
Charset.isSupported(String)
public void setContentResolver(ContentResolver contentResolver)
Connector
Connector.getContent(String)
.setContentResolver
in interface Connector
setContentResolver
in class AbstractConnector
contentResolver
- the ContentResolver to set.protected ContentResolver getContentResolver()
getContentResolver
in class AbstractConnector
Copyright © 2008–2016 Brabenetz Harald, Austria. All rights reserved.