Package com.mayam.wf.siteconfig
Class AbstractSiteConfig
java.lang.Object
com.mayam.wf.siteconfig.AbstractSiteConfig
- Direct Known Subclasses:
SiteConfig
Abstract class for site configuration. Mostly a supporting class for
SiteConfig
,
it can also be used to create lib or ws specific site configurations or even site code
specific configurations in separate properties files.
The implementation class is expected to have getters annotated with AbstractSiteConfig.Config
that
return either String or Boolean. A matching setter is required.- Author:
- Markus MÃ¥rtensson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Binds a SiteConfig getter to its key in the properties file and also provides a default value.static @interface
Declares a specific configuration setting as reloadable, which means that the value will be updated in runtime. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static String
ensureSlashSuffix
(String url) Utility method that ensures a URL string ends with a slash.protected static <T extends AbstractSiteConfig>
TfromProperties
(Class<T> clazz, Properties properties) protected static <T extends AbstractSiteConfig>
TfromPropertiesFile
(Class<T> clazz, String filePath) static <T extends AbstractSiteConfig>
booleanhaveReloadable
(Class<T> clazz) static <T extends AbstractSiteConfig>
voidsetSiteConfigValue
(AbstractSiteConfig s, Class<T> clazz, Method m, Properties properties, StringBuilder sb)
-
Constructor Details
-
AbstractSiteConfig
public AbstractSiteConfig()
-
-
Method Details
-
fromPropertiesFile
protected static <T extends AbstractSiteConfig> T fromPropertiesFile(Class<T> clazz, String filePath) -
fromProperties
protected static <T extends AbstractSiteConfig> T fromProperties(Class<T> clazz, Properties properties) -
setSiteConfigValue
public static <T extends AbstractSiteConfig> void setSiteConfigValue(AbstractSiteConfig s, Class<T> clazz, Method m, Properties properties, StringBuilder sb) -
haveReloadable
-
ensureSlashSuffix
Utility method that ensures a URL string ends with a slash.- Parameters:
url
- URL that needs a slash suffix.- Returns:
- original URL or a suffixed copy.
-