|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.metatype.internal.LocalizedObjectClassDefinition
public class LocalizedObjectClassDefinition
The LocalizedObjectClassDefinition class is the implementation
of the ObjectClassDefinition interface. This class delegates
calls to the underlying OCD localizing the results of the following
methods: getName(), getDescription(), and
getIcon(int).
| Field Summary |
|---|
| Fields inherited from interface org.osgi.service.metatype.ObjectClassDefinition |
|---|
ALL, OPTIONAL, REQUIRED |
| Constructor Summary | |
|---|---|
LocalizedObjectClassDefinition(Bundle bundle,
OCD ocd,
Resources resources)
Creates and instance of this localizing facade. |
|
| Method Summary | |
|---|---|
AttributeDefinition[] |
getAttributeDefinitions(int filter)
|
String |
getDescription()
|
InputStream |
getIcon(int size)
|
String |
getID()
|
String |
getName()
|
protected Resources |
getResources()
Returns the Resources assigned to this instance. |
protected String |
localize(String string)
Localizes the string using the ResourceBundle set on this instance if
string starts with the percent character (%). |
protected String[] |
localize(String[] strings)
Calls localize(String) for each string in the array and returns
an array of the resulting localized strings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LocalizedObjectClassDefinition(Bundle bundle,
OCD ocd,
Resources resources)
bundle - The Bundle providing this object class
definition.ocd - The OCD to which calls are delegated.resources - The Resources used to localize return values of
localizable methods.| Method Detail |
|---|
public AttributeDefinition[] getAttributeDefinitions(int filter)
getAttributeDefinitions in interface ObjectClassDefinitionfilter - ObjectClassDefinition.getAttributeDefinitions(int)public String getDescription()
getDescription in interface ObjectClassDefinitionObjectClassDefinition.getDescription()
public InputStream getIcon(int size)
throws IOException
getIcon in interface ObjectClassDefinitionsize -
IOExceptionObjectClassDefinition.getIcon(int)public String getID()
getID in interface ObjectClassDefinitionObjectClassDefinition.getID()public String getName()
getName in interface ObjectClassDefinitionObjectClassDefinition.getName()protected Resources getResources()
Resources assigned to this instance.
protected String[] localize(String[] strings)
localize(String) for each string in the array and returns
an array of the resulting localized strings. If strings is
null null is returned.
strings - An array of non-null strings to localize.
null if strings is null or
an array of the same size as the strings array
containing localized strings.protected String localize(String string)
ResourceBundle set on this instance if
string starts with the percent character (%). If the
string is null, does not start with a percent character
or the resource whose key is the string without the leading the percent
character is not found the string is returned without the leading percent
character.
Examples of different localizations:
string |
Key | Resource | Result |
|---|---|---|---|
null |
- | - | null |
| sample | - | - | sample |
| %sample | sample | - | sample |
| %sample | sample | resource | resource |
string - The string to localize
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||