Sha256: cf15cbaaa57698e44b919a4dc3e6c01ea78f5345ad850245a21bf2f4ccf0a4af

Contents?: true

Size: 828 Bytes

Versions: 12

Compression:

Stored size: 828 Bytes

Contents

package com.rhomobile.rhodes.api;

import java.util.HashMap;
import java.util.Map;

public abstract class RhoApiFactory <IApi extends IRhoApiObject, IApiSingleton> {
    IApiSingleton mApiSingleton;
    Map<String, IApi> mApiObjects;
    
    public RhoApiFactory() {
        mApiObjects = new HashMap<String, IApi>();
    }

    public IApiSingleton getApiSingleton() {
        if (mApiSingleton == null)
            mApiSingleton = createSingleton();

        return mApiSingleton;
    }

    public IApi getApiObject(String id) {
        IApi obj = mApiObjects.get(id);
        if (obj == null) {
            obj = createApiObject(id);
            mApiObjects.put(id, obj);
        }
        return obj;
    }

    protected abstract IApiSingleton createSingleton();
    protected abstract IApi createApiObject(String id);
}

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rhodes-6.0.11 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.18 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.17 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.15 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.0.22 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.2 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.0.7 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.0.3 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
rhodes-5.5.0 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
tauplatform-1.0.3 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
tauplatform-1.0.2 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java
tauplatform-1.0.1 platform/android/Rhodes/src/com/rhomobile/rhodes/api/RhoApiFactory.java