Saber

SharedPreferences "injection" for Android.

License

License

GroupId

GroupId

com.jug6ernaut
ArtifactId

ArtifactId

saber
Last Version

Last Version

0.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

Saber
SharedPreferences "injection" for Android.

Download saber

How to add to project

<!-- https://jarcasting.com/artifacts/com.jug6ernaut/saber/ -->
<dependency>
    <groupId>com.jug6ernaut</groupId>
    <artifactId>saber</artifactId>
    <version>0.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.jug6ernaut/saber/
implementation 'com.jug6ernaut:saber:0.5.0'
// https://jarcasting.com/artifacts/com.jug6ernaut/saber/
implementation ("com.jug6ernaut:saber:0.5.0")
'com.jug6ernaut:saber:jar:0.5.0'
<dependency org="com.jug6ernaut" name="saber" rev="0.5.0">
  <artifact name="saber" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jug6ernaut', module='saber', version='0.5.0')
)
libraryDependencies += "com.jug6ernaut" % "saber" % "0.5.0"
[com.jug6ernaut/saber "0.5.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.3.1

provided (1)

Group / Artifact Type Version
com.google.android : android jar 4.1.1.4

test (6)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.8.4
com.google.truth : truth jar 0.27
com.google.testing.compile : compile-testing jar 0.4
junit : junit jar 4.10
org.easytesting : fest-assert-core jar 2.0M10
org.robolectric : robolectric jar 2.4

Project Modules

There are no modules declared in this project.

Saber Build Status

Android SharedPreferences wrapper and injector. Based on Dart, which was originally based on ButterKnife.

SharedPreference "injection" library for Android which uses annotation processing to generate code that does direct field assignment of your SharedPreference..

Usage

@PreferenceConfig(file = "someFile") // optional, file used for all sub @Preference unless override
public class MainActivity extends Activity {

  @Bind Preference<Boolean> boolPreference; // no information needed

  @Override protected void onCreate(Bundle savedInstanceState) {
    Saber.inject(this);

    Boolean bool = boolPreference.get();
    boolPreference.set(true);
  }
  
}

Saber provides wrapper classes for all shared preference applicable value types, preferenceType safe and null safe.

IntPreference
LongPreference
FloatPreference
BooleanPreference
StringPreference
StringSetPreference

Configuration

@Bind Has 3 fields, all optional

key Key to be used, if not provided variable name is used.

file File to use, if not provided the default is used.

dv Default value to be used, if not provided the class specific value will be used.

Download

Download the latest JAR via Maven:

<dependency>
  <groupId>com.jug6ernaut.saber</groupId>
  <artifactId>saber</artifactId>
  <version>0.6.0</version>
</dependency>

or Gradle:

compile 'com.jug6ernaut.saber:saber:0.6.0'

License

Copyright 2015 William Webb
Copyright 2014 Prateek Srivastava (@f2prateek)
Copyright 2013 Jake Wharton

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.

Versions

Version
0.5.0