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
public static class ICUService.SimpleFactory extends java.lang.Object implements ICUService.Factory
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.
-
-
Constructor Summary
Constructors Constructor Description SimpleFactory(java.lang.Object instance, java.lang.String id)
Convenience constructor that calls SimpleFactory(Object, String, boolean) with visible true.SimpleFactory(java.lang.Object instance, java.lang.String id, boolean visible)
Construct a simple factory that maps a single id to a single service instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
create(ICUService.Key key, ICUService service)
Return the service instance if the factory's id is equal to the key's currentID.java.lang.String
getDisplayName(java.lang.String identifier, ULocale locale)
If this.id equals id, returns id regardless of locale, otherwise returns null.java.lang.String
toString()
For debugging.void
updateVisibleIDs(java.util.Map<java.lang.String,ICUService.Factory> result)
If visible, adds a mapping from id -> this to the result, otherwise removes id from result.
-
-
-
Constructor Detail
-
SimpleFactory
public SimpleFactory(java.lang.Object instance, java.lang.String id)
Convenience constructor that calls SimpleFactory(Object, String, boolean) with visible true.
-
SimpleFactory
public SimpleFactory(java.lang.Object instance, java.lang.String id, boolean visible)
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 Detail
-
create
public java.lang.Object create(ICUService.Key key, ICUService service)
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
public void updateVisibleIDs(java.util.Map<java.lang.String,ICUService.Factory> result)
If visible, adds a mapping from id -> this to the result, otherwise removes id from result.- Specified by:
updateVisibleIDs
in interfaceICUService.Factory
-
getDisplayName
public java.lang.String getDisplayName(java.lang.String identifier, ULocale locale)
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
public java.lang.String toString()
For debugging.- Overrides:
toString
in classjava.lang.Object
-
-