// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/PreferencesMode.java
// public enum PreferencesMode {
// 
//     /**
//      * Default.
//      * 
//      * @see android.content.Context#MODE_PRIVATE
//      */
//     MODE_PRIVATE(Context.MODE_PRIVATE),
//     
//     /**
//      * @see android.content.Context#MODE_MULTI_PROCESS
//      */
//     MODE_MULTI_PROCESS(Context.MODE_MULTI_PROCESS),
//     
//     /**
//      * @see android.content.Context#MODE_WORLD_READABLE
//      */
//     @Deprecated
//     MODE_WORLD_READABLE(Context.MODE_WORLD_READABLE),
//     
//     /**
//      * @see android.content.Context#MODE_WORLD_WRITEABLE
//      */
//     @Deprecated
//     MODE_WORLD_WRITEABLE(Context.MODE_WORLD_WRITEABLE);
//     
//     private final int value;
//     
//     private PreferencesMode(int value) {
//         this.value = value;
//     }
//     
//     public int value() {
//         return value;
//     }
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/PreferencesType.java
// public enum PreferencesType {
// 
//     /**
//      * Default.
//      * 
//      * @see net.orange_box.storebox.annotations.type.DefaultSharedPreferences
//      * @see android.preference.PreferenceManager#getDefaultSharedPreferences(
//      * android.content.Context)
//      */
//     DEFAULT_SHARED,
// 
//     /**
//      * @see net.orange_box.storebox.annotations.type.ActivityPreferences
//      * @see android.app.Activity#getPreferences(int)
//      */
//     ACTIVITY,
// 
//     /**
//      * @see net.orange_box.storebox.annotations.type.FilePreferences
//      * @see android.content.Context#getSharedPreferences(String, int)
//      */
//     FILE
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/SaveMode.java
// public enum SaveMode {
// 
//     /**
//      * Default.
//      *
//      * @see android.content.SharedPreferences.Editor#apply()
//      */
//     APPLY,
// 
//     /**
//      * @see android.content.SharedPreferences.Editor#commit()
//      */
//     COMMIT,
// 
//     /**
//      * {@link android.content.SharedPreferences.Editor#apply()} or
//      * {@link android.content.SharedPreferences.Editor#commit()} will have
//      * to be called explicitly.
//      */
//     NOME
// }


import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import net.orange_box.storebox.annotations.option.SaveOption;
import net.orange_box.storebox.annotations.type.ActivityPreferences;
import net.orange_box.storebox.annotations.type.DefaultSharedPreferences;
import net.orange_box.storebox.annotations.type.FilePreferences;
import net.orange_box.storebox.enums.PreferencesMode;
import net.orange_box.storebox.enums.PreferencesType;
import net.orange_box.storebox.enums.SaveMode;
import java.lang.reflect.Proxy;
import java.util.Locale;
/*
 * Copyright 2015 Martin Bella
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.orange_box.storebox;




/**
 * Creates a no-thrills instance of the supplied interface, by reading any
 * options provided through interface-level annotations.
 * <p>
 * If you'd like to provide options dynamically at run-time, take a look at
 * {@link Builder}.
 */
public final class StoreBox {

    /**
     * @param context - the context under which the
     * {@link android.content.SharedPreferences} should be opened
     * @param cls - the interface class which should be instantiated
     * @return new instance of class {@code cls} using {@code context}
     */
    public static <T> T create(Context context, Class<T> cls) {
        return new Builder<>(context, cls).build();
    }

    private StoreBox() {}

    /**
     * Can be used to provide a customised instance of the supplied interface,
     * by setting custom options through builder methods.
     * 
     * @param <T>
     */
    public static final class Builder<T> {

        private final Context context;
        private final Class<T> cls;

// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/PreferencesMode.java
// public enum PreferencesMode {
// 
//     /**
//      * Default.
//      * 
//      * @see android.content.Context#MODE_PRIVATE
//      */
//     MODE_PRIVATE(Context.MODE_PRIVATE),
//     
//     /**
//      * @see android.content.Context#MODE_MULTI_PROCESS
//      */
//     MODE_MULTI_PROCESS(Context.MODE_MULTI_PROCESS),
//     
//     /**
//      * @see android.content.Context#MODE_WORLD_READABLE
//      */
//     @Deprecated
//     MODE_WORLD_READABLE(Context.MODE_WORLD_READABLE),
//     
//     /**
//      * @see android.content.Context#MODE_WORLD_WRITEABLE
//      */
//     @Deprecated
//     MODE_WORLD_WRITEABLE(Context.MODE_WORLD_WRITEABLE);
//     
//     private final int value;
//     
//     private PreferencesMode(int value) {
//         this.value = value;
//     }
//     
//     public int value() {
//         return value;
//     }
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/PreferencesType.java
// public enum PreferencesType {
// 
//     /**
//      * Default.
//      * 
//      * @see net.orange_box.storebox.annotations.type.DefaultSharedPreferences
//      * @see android.preference.PreferenceManager#getDefaultSharedPreferences(
//      * android.content.Context)
//      */
//     DEFAULT_SHARED,
// 
//     /**
//      * @see net.orange_box.storebox.annotations.type.ActivityPreferences
//      * @see android.app.Activity#getPreferences(int)
//      */
//     ACTIVITY,
// 
//     /**
//      * @see net.orange_box.storebox.annotations.type.FilePreferences
//      * @see android.content.Context#getSharedPreferences(String, int)
//      */
//     FILE
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/enums/SaveMode.java
// public enum SaveMode {
// 
//     /**
//      * Default.
//      *
//      * @see android.content.SharedPreferences.Editor#apply()
//      */
//     APPLY,
// 
//     /**
//      * @see android.content.SharedPreferences.Editor#commit()
//      */
//     COMMIT,
// 
//     /**
//      * {@link android.content.SharedPreferences.Editor#apply()} or
//      * {@link android.content.SharedPreferences.Editor#commit()} will have
//      * to be called explicitly.
//      */
//     NOME
// }


// Path: storebox-lib/src/main/java/net/orange_box/storebox/StoreBox.java
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import net.orange_box.storebox.annotations.option.SaveOption;
import net.orange_box.storebox.annotations.type.ActivityPreferences;
import net.orange_box.storebox.annotations.type.DefaultSharedPreferences;
import net.orange_box.storebox.annotations.type.FilePreferences;
import net.orange_box.storebox.enums.PreferencesMode;
import net.orange_box.storebox.enums.PreferencesType;
import net.orange_box.storebox.enums.SaveMode;
import java.lang.reflect.Proxy;
import java.util.Locale;

/*
 * Copyright 2015 Martin Bella
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.orange_box.storebox;




/**
 * Creates a no-thrills instance of the supplied interface, by reading any
 * options provided through interface-level annotations.
 * <p>
 * If you'd like to provide options dynamically at run-time, take a look at
 * {@link Builder}.
 */
public final class StoreBox {

    /**
     * @param context - the context under which the
     * {@link android.content.SharedPreferences} should be opened
     * @param cls - the interface class which should be instantiated
     * @return new instance of class {@code cls} using {@code context}
     */
    public static <T> T create(Context context, Class<T> cls) {
        return new Builder<>(context, cls).build();
    }

    private StoreBox() {}

    /**
     * Can be used to provide a customised instance of the supplied interface,
     * by setting custom options through builder methods.
     * 
     * @param <T>
     */
    public static final class Builder<T> {

        private final Context context;
        private final Class<T> cls;

        private PreferencesType preferencesType = PreferencesType.DEFAULT_SHARED;