public interface RuleResources
The localization for the resources is specified in .properties files in the same Java package as the rule itself. The
name of the properties file must match the rule class name. See Properties
for details. Use getString(String)
and getString(String, Object...)
methods to access localized Strings.
Files of a rule that has English, French and German localization:
Contents of MyRule.properties:
# The required rule information. # Note: These should be only in the English properties file. AUTHOR=The author of the rule AUTHOR_TAG=MyTag UID=12345 VERSION=1.0 DATE=2018-01-01 # The localization of the name and description of the rule DEFAULT_NAME=My Rule DEFAULT_DESCRIPTION=This rule checks the quality of the model. # The localization of a parameter which parameter ID is rpComponentFilter rpComponentFilter.NAME = Components to Check rpComponentFilter.DESCRIPTION = This filter specifies the set of components to check
Modifier and Type | Method and Description |
---|---|
static RuleResources |
getCommon()
Return the common resources shared between all the rules.
|
URL |
getImageUrl(String filename)
Returns the URL of the image with filename.
|
ResourceBundle |
getJavaResourceBundle()
Returns the resource bundle of the rule.
|
String |
getString(String key)
Returns localized string mapped by the key.
|
String |
getString(String key,
Object... messageFormatArgs)
Returns localized string mapped by the key.
|
static RuleResources |
of(Rule rule)
Return the resources of the specified rule instance.
|
static RuleResources of(Rule rule)
rule
- the rule instancestatic RuleResources getCommon()
ResourceBundle getJavaResourceBundle()
String getString(String key, Object... messageFormatArgs)
key
- the key e.g. "DEFAULT_NAME"messageFormatArgs
- the arguments for java.text.MessageFormatString getString(String key)
key
- the key e.g. "DEFAULT_NAME"URL getImageUrl(String filename)
filename
- the filename of an image resourceCopyright © 2019 Solibri, Inc.. All rights reserved.