/// <summary> /// Return the service instance if the factory's id is equal to /// the <paramref name="key"/>'s <see cref="ICUServiceKey.CurrentID"/>. /// <paramref name="service"/> is ignored. /// </summary> public virtual object Create(ICUServiceKey key, ICUService service) { if (id.Equals(key.CurrentID)) { return(instance); } return(null); }
/// <summary> /// Implement superclass abstract method. This checks the <see cref="ICUServiceKey.CurrentID"/> /// against the supported IDs, and passes the canonicalLocale and /// <see cref="LocaleKey.Kind"/> to <see cref="HandleCreate(UCultureInfo, int, ICUService)"/> (which subclasses must implement). /// </summary> public virtual object Create(ICUServiceKey key, ICUService service) { if (HandlesKey(key)) { LocaleKey lkey = (LocaleKey)key; int kind = lkey.Kind; UCultureInfo uloc = lkey.GetCurrentCulture(); return(HandleCreate(uloc, kind, service)); } else { // System.out.println("factory: " + this + " did not support id: " + key.currentID()); // System.out.println("supported ids: " + getSupportedIDs()); } return(null); }
/// <summary> /// Returns the service object if kind/locale match. Service is not used. /// </summary> public override object Create(ICUServiceKey key, ICUService service) { if (!(key is LocaleKey)) { return(null); } LocaleKey lkey = (LocaleKey)key; if (kind != LocaleKey.KindAny && kind != lkey.Kind) { return(null); } if (!id.Equals(lkey.CurrentID)) { return(null); } return(obj); }
/// <summary> /// Create the service. The default implementation returns the resource bundle /// for the locale, ignoring kind, and service. /// </summary> protected override object HandleCreate(UCultureInfo loc, int kind, ICUService service) { return(ICUResourceBundle.GetBundleInstance(bundleName, loc, Assembly)); }
//CLOVER:OFF /// <summary> /// Utility method used by <see cref="Create(ICUServiceKey, ICUService)"/>. Subclasses can /// implement this instead of <see cref="Create(ICUServiceKey, ICUService)"/>. /// </summary> protected virtual object HandleCreate(UCultureInfo loc, int kind, ICUService service) { return(null); }
//CLOVER:OFF /// <summary> /// Utility method used by <see cref="Create(Key, ICUService)"/>. Subclasses can /// implement this instead of <see cref="Create(Key, ICUService)"/>. /// </summary> protected virtual object HandleCreate(ULocale loc, int kind, ICUService service) { return(null); }