Package com.ibm.icu.impl
Class ICUService.SimpleFactory
java.lang.Object
com.ibm.icu.impl.ICUService.SimpleFactory
- All Implemented Interfaces:
ICUService.Factory
- Enclosing class:
- ICUService
A default implementation of factory. This provides default
implementations for subclasses, and implements a singleton
factory that matches a single id and returns a single
(possibly deferred-initialized) instance. This implements
updateVisibleIDs to add a mapping from its ID to itself
if visible is true, or to remove any existing mapping
for its ID if visible is false.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleFactory
(Object instance, String id) Convenience constructor that calls SimpleFactory(Object, String, boolean) with visible true.SimpleFactory
(Object instance, String id, boolean visible) Construct a simple factory that maps a single id to a single service instance. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(ICUService.Key key, ICUService service) Return the service instance if the factory's id is equal to the key's currentID.getDisplayName
(String identifier, ULocale locale) If this.id equals id, returns id regardless of locale, otherwise returns null.toString()
For debugging.void
updateVisibleIDs
(Map<String, ICUService.Factory> result) If visible, adds a mapping from id -> this to the result, otherwise removes id from result.
-
Field Details
-
instance
-
id
-
visible
protected boolean visible
-
-
Constructor Details
-
SimpleFactory
Convenience constructor that calls SimpleFactory(Object, String, boolean) with visible true. -
SimpleFactory
Construct a simple factory that maps a single id to a single service instance. If visible is true, the id will be visible. Neither the instance nor the id can be null.
-
-
Method Details
-
create
Return the service instance if the factory's id is equal to the key's currentID. Service is ignored.- Specified by:
create
in interfaceICUService.Factory
-
updateVisibleIDs
If visible, adds a mapping from id -> this to the result, otherwise removes id from result.- Specified by:
updateVisibleIDs
in interfaceICUService.Factory
-
getDisplayName
If this.id equals id, returns id regardless of locale, otherwise returns null. (This default implementation has no localized id information.)- Specified by:
getDisplayName
in interfaceICUService.Factory
-
toString
For debugging.
-