com.backendless.persistence.local.UserIdStorageFactory Maven / Gradle / Ivy
/*
* ********************************************************************************************************************
*
* BACKENDLESS.COM CONFIDENTIAL
*
* ********************************************************************************************************************
*
* Copyright 2012 BACKENDLESS.COM. All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
* suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret
* or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Backendless.com.
*
* ********************************************************************************************************************
*/
package com.backendless.persistence.local;
import android.content.Context;
import com.backendless.Backendless;
import com.backendless.exceptions.ExceptionMessage;
public class UserIdStorageFactory
{
static final String key = "user-id";
private static AndroidUserIdStorage androidUserIdStorage;
private static UserIdStorageFactory instance = new UserIdStorageFactory();
public static UserIdStorageFactory instance()
{
return instance;
}
private UserIdStorageFactory()
{
}
public void init( Context context )
{
androidUserIdStorage = new AndroidUserIdStorage( context );
}
public IStorage getStorage()
{
if( Backendless.isAndroid() && androidUserIdStorage == null )
throw new IllegalArgumentException( ExceptionMessage.INIT_BEFORE_USE );
if( Backendless.isAndroid() )
return androidUserIdStorage;
if( Backendless.isCodeRunner() )
return CodeRunnerUserIdStorage.instance();
return JavaUserIdStorage.instance();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy