Example #1
0
 /// <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);
 }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
        }
Example #4
0
 /// <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));
 }
Example #5
0
 //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);
 }
Example #6
0
 //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);
 }