Skip to content

Commit

Permalink
[property] add dexcount to determine lib method count. Consolidate pr…
Browse files Browse the repository at this point in the history
…operty classes into base class that cuts method count by 100.
  • Loading branch information
agrosner committed Dec 31, 2016
1 parent 774b65d commit 5762922
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 614 deletions.
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.2'
}
}

Expand Down
12 changes: 7 additions & 5 deletions dbflow-tests/build.gradle
@@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.getkeepsafe.dexcount'

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -31,11 +33,6 @@ android {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}

buildTypes {
debug {
minifyEnabled true
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
Expand Down Expand Up @@ -80,4 +77,9 @@ buildscript {

kapt {
generateStubs = true
}

dexcount {
includeClasses = true
orderByMethodCount = true
}
Expand Up @@ -4,15 +4,14 @@
import com.raizlabs.android.dbflow.sql.language.Condition;
import com.raizlabs.android.dbflow.sql.language.ITypeConditional;
import com.raizlabs.android.dbflow.sql.language.NameAlias;
import com.raizlabs.android.dbflow.structure.Model;

import static com.raizlabs.android.dbflow.sql.language.Condition.column;

/**
* Description: Basic {@link byte} property. Accepts only byte, {@link BaseModelQueriable}, and
* {@link ITypeConditional} objects.
*/
public class ByteProperty extends BaseProperty<ByteProperty> {
public class ByteProperty extends PrimitiveProperty<ByteProperty> {

public ByteProperty(Class<?> table, NameAlias nameAlias) {
super(table, nameAlias);
Expand All @@ -27,60 +26,8 @@ public ByteProperty(Class<?> table, String columnName, String aliasName) {
}

@Override
public ByteProperty as(String aliasName) {
return new ByteProperty(table, nameAlias
.newBuilder()
.as(aliasName)
.build());
}

@Override
public ByteProperty plus(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.PLUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty minus(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.MINUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty dividedBy(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.DIVISION,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty multipliedBy(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.MULTIPLY,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty mod(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.MOD,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty concatenate(IProperty iProperty) {
return new ByteProperty(table, NameAlias.joinNames(Condition.Operation.CONCATENATE,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public ByteProperty distinct() {
return new ByteProperty(table, getDistinctAliasName());
}

@Override
public ByteProperty withTable(NameAlias tableNameAlias) {
return new ByteProperty(table, nameAlias
.newBuilder()
.withTable(tableNameAlias.getQuery())
.build());
protected ByteProperty newPropertyInstance(Class<?> table, NameAlias nameAlias) {
return new ByteProperty(table, nameAlias);
}

public Condition is(byte value) {
Expand Down Expand Up @@ -150,36 +97,4 @@ public Condition.In notIn(byte firstValue, byte... values) {
public Condition concatenate(byte value) {
return column(nameAlias).concatenate(value);
}

public Condition is(ByteProperty property) {
return column(nameAlias).is(property);
}

public Condition isNot(ByteProperty property) {
return column(nameAlias).isNot(property);
}

public Condition eq(ByteProperty property) {
return is(property);
}

public Condition notEq(ByteProperty property) {
return isNot(property);
}

public Condition greaterThan(ByteProperty property) {
return column(nameAlias).greaterThan(property);
}

public Condition greaterThanOrEq(ByteProperty property) {
return column(nameAlias).greaterThanOrEq(property);
}

public Condition lessThan(ByteProperty property) {
return column(nameAlias).lessThan(property);
}

public Condition lessThanOrEq(ByteProperty property) {
return column(nameAlias).lessThanOrEq(property);
}
}
Expand Up @@ -2,14 +2,13 @@

import com.raizlabs.android.dbflow.sql.language.Condition;
import com.raizlabs.android.dbflow.sql.language.NameAlias;
import com.raizlabs.android.dbflow.structure.Model;

import static com.raizlabs.android.dbflow.sql.language.Condition.column;

/**
* Description:
*/
public class CharProperty extends BaseProperty<CharProperty> {
public class CharProperty extends PrimitiveProperty<CharProperty> {

public CharProperty(Class<?> table, NameAlias nameAlias) {
super(table, nameAlias);
Expand All @@ -24,60 +23,8 @@ public CharProperty(Class<?> table, String columnName, String aliasName) {
}

@Override
public CharProperty plus(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.PLUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty minus(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.MINUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty dividedBy(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.DIVISION,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty multipliedBy(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.MULTIPLY,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty mod(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.MOD,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty concatenate(IProperty iProperty) {
return new CharProperty(table, NameAlias.joinNames(Condition.Operation.CONCATENATE,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public CharProperty as(String aliasName) {
return new CharProperty(table, nameAlias
.newBuilder()
.as(aliasName)
.build());
}

@Override
public CharProperty distinct() {
return new CharProperty(table, getDistinctAliasName());
}

@Override
public CharProperty withTable(NameAlias tableNameAlias) {
return new CharProperty(table, nameAlias
.newBuilder()
.withTable(tableNameAlias.getQuery())
.build());
protected CharProperty newPropertyInstance(Class<?> table, NameAlias nameAlias) {
return new CharProperty(table, nameAlias);
}

public Condition is(char value) {
Expand Down Expand Up @@ -148,35 +95,4 @@ public Condition concatenate(char value) {
return column(nameAlias).concatenate(value);
}

public Condition is(CharProperty property) {
return column(nameAlias).is(property);
}

public Condition isNot(CharProperty property) {
return column(nameAlias).isNot(property);
}

public Condition eq(CharProperty property) {
return is(property);
}

public Condition notEq(CharProperty property) {
return isNot(property);
}

public Condition greaterThan(CharProperty property) {
return column(nameAlias).greaterThan(property);
}

public Condition greaterThanOrEq(CharProperty property) {
return column(nameAlias).greaterThanOrEq(property);
}

public Condition lessThan(CharProperty property) {
return column(nameAlias).lessThan(property);
}

public Condition lessThanOrEq(CharProperty property) {
return column(nameAlias).lessThanOrEq(property);
}
}
}
Expand Up @@ -11,7 +11,7 @@
* Description: Basic {@link float} property. Accepts only float, {@link BaseModelQueriable}, and
* {@link ITypeConditional} objects.
*/
public class DoubleProperty extends BaseProperty<DoubleProperty> {
public class DoubleProperty extends PrimitiveProperty<DoubleProperty> {

public DoubleProperty(Class<?> table, NameAlias nameAlias) {
super(table, nameAlias);
Expand All @@ -26,59 +26,8 @@ public DoubleProperty(Class<?> table, String columnName, String aliasName) {
}

@Override
public DoubleProperty plus(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.PLUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty minus(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.MINUS,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty dividedBy(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.DIVISION,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty multipliedBy(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.MULTIPLY,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty mod(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.MOD,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty concatenate(IProperty iProperty) {
return new DoubleProperty(table, NameAlias.joinNames(Condition.Operation.CONCATENATE,
nameAlias.fullName(), iProperty.toString()));
}

@Override
public DoubleProperty as(String aliasName) {
return new DoubleProperty(table, nameAlias
.newBuilder()
.as(aliasName).build());
}

@Override
public DoubleProperty distinct() {
return new DoubleProperty(table, getDistinctAliasName());
}

@Override
public DoubleProperty withTable(NameAlias tableNameAlias) {
return new DoubleProperty(table, nameAlias
.newBuilder()
.withTable(tableNameAlias.getQuery())
.build());
protected DoubleProperty newPropertyInstance(Class<?> table, NameAlias nameAlias) {
return new DoubleProperty(table, nameAlias);
}

public Condition is(double value) {
Expand Down Expand Up @@ -149,35 +98,4 @@ public Condition concatenate(double value) {
return column(nameAlias).concatenate(value);
}

public Condition is(DoubleProperty property) {
return column(nameAlias).is(property);
}

public Condition isNot(DoubleProperty property) {
return column(nameAlias).isNot(property);
}

public Condition eq(DoubleProperty property) {
return is(property);
}

public Condition notEq(DoubleProperty property) {
return isNot(property);
}

public Condition greaterThan(DoubleProperty property) {
return column(nameAlias).greaterThan(property);
}

public Condition greaterThanOrEq(DoubleProperty property) {
return column(nameAlias).greaterThanOrEq(property);
}

public Condition lessThan(DoubleProperty property) {
return column(nameAlias).lessThan(property);
}

public Condition lessThanOrEq(DoubleProperty property) {
return column(nameAlias).lessThanOrEq(property);
}
}

0 comments on commit 5762922

Please sign in to comment.