public interface ContentResolver
Example configuration in settings4j.xml: -------------------------------------- <contentResolver name="ClasspathContentResolver" class="org.settings4j.contentresolver.ClasspathContentResolver"> </contentResolver> --------------------------------------This is usefull for
SystemPropertyConnector
or PropertyFileConnector
.
If you define a ContentResolver in this Connectors, you can rever to a File of the FileSystem or Classpath.
Example Connector usage in settings4j.xml: -------------------------------------- <connector name="SystemPropertyConnector" class="org.settings4j.connector.SystemPropertyConnector" > <contentResolver-ref ref="ClasspathContentResolver" /> </connector> -------------------------------------- Example usage in java-code: -------------------------------------- // alternativ start myapp with -Dxyz=com/mycompany/myapp/xyz-config.xml System.setProperty("xyz", "com/mycompany/myapp/xyz-config.xml"); //refer to the ClasspathContentResolver // somewhere in myapp: byte[] xyzConfig = Settings4j.getContent("xyz"); // get Classpath-URL from the SystemPropertyConnector --------------------------------------
Modifier and Type | Method and Description |
---|---|
void |
addContentResolver(ContentResolver contentResolver)
Some Implementations of a
ContentResolver are delegating the functionality
to other ContentResolvers. |
byte[] |
getContent(String key)
Reads the Content for the given Key or null if nothing where found.
|
byte[] getContent(String key)
key
- The keyvoid addContentResolver(ContentResolver contentResolver)
ContentResolver
are delegating the functionality
to other ContentResolvers.UnionContentResolver
-------------------------------------- <contentResolver name="DefaultContentResolver" class="org.settings4j.contentresolver.UnionContentResolver"> <contentResolver-ref ref="FSContentResolver" /> <contentResolver-ref ref="ClasspathContentResolver" /> </contentResolver> --------------------------------------
contentResolver
- the original contentResolver to delegate.Copyright © 2008–2014. All rights reserved.