Android Open Source - adme A D M E Field Config






From Project

Back to project page adme.

License

The source code is released under:

Apache License

If you think the Android project adme listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.danielesegato.adme.config;
//ww w  .j a v a2  s  . c o  m
import com.danielesegato.adme.db.ADMESerializer;

import java.lang.reflect.Field;

/**
 * Store the configuration of an ADME field annotated with {@link com.danielesegato.adme.annotation.ADMEField}
 */
public class ADMEFieldConfig {
    private String columnName;
    private boolean id;
    private boolean generatedId;
    private boolean nullable;
    private String defaultValue;
    private boolean useGetSet;
    private boolean foreign;
    private OnForeignUpdateDelete foreignOnDelete;
    private OnForeignUpdateDelete foreignOnUpdate;
    private ADMEFieldConfig foreignFieldConfig;
    private Field javaField;
    private ADMEEntityConfig<?> ADMEEntityConfig;
    private ADMEIndexConstraintConfig indexConstraint;
    private ADMESerializer admeSerializer;
    private String fallbackEnumName;

    public boolean isId() {
        return id;
    }

    public void setId(boolean id) {
        this.id = id;
    }

    public boolean isGeneratedId() {
        return generatedId;
    }

    public void setGeneratedId(boolean generatedId) {
        this.generatedId = generatedId;
    }

    public boolean isNullable() {
        return nullable;
    }

    public void setNullable(boolean nullable) {
        this.nullable = nullable;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public boolean isUseGetSet() {
        return useGetSet;
    }

    public void setUseGetSet(boolean useGetSet) {
        this.useGetSet = useGetSet;
    }

    public boolean isForeign() {
        return foreign;
    }

    public void setForeign(boolean foreign) {
        this.foreign = foreign;
    }

    public OnForeignUpdateDelete getForeignOnDelete() {
        return foreignOnDelete;
    }

    public void setForeignOnDelete(OnForeignUpdateDelete foreignOnDelete) {
        this.foreignOnDelete = foreignOnDelete;
    }

    public OnForeignUpdateDelete getForeignOnUpdate() {
        return foreignOnUpdate;
    }

    public void setForeignOnUpdate(OnForeignUpdateDelete foreignOnUpdate) {
        this.foreignOnUpdate = foreignOnUpdate;
    }

    public ADMEFieldConfig getForeignFieldConfig() {
        // lazy initialize to avoid recursions
        if (foreign && foreignFieldConfig == null) {
            this.foreignFieldConfig = ADMEConfigUtils.lookupADMEIDFieldConfig(getJavaField().getType());
        }
        return foreignFieldConfig;
    }

    public void setForeignFieldConfig(ADMEFieldConfig foreignFieldConfig) {
        this.foreignFieldConfig = foreignFieldConfig;
    }

    public Field getJavaField() {
        return javaField;
    }

    public void setJavaField(Field javaField) {
        this.javaField = javaField;
    }

    public ADMEEntityConfig<?> getADMEEntityConfig() {
        return ADMEEntityConfig;
    }

    public void setADMEEntityConfig(ADMEEntityConfig<?> ADMEEntityConfig) {
        this.ADMEEntityConfig = ADMEEntityConfig;
    }

    public ADMEIndexConstraintConfig getIndexConstraint() {
        return indexConstraint;
    }

    public void setIndexConstraint(ADMEIndexConstraintConfig indexConstraint) {
        this.indexConstraint = indexConstraint;
    }

    public void setDefault(String aDefault) {
        this.defaultValue = aDefault;
    }

    public ADMESerializer getADMESerializer() {
        if (this.admeSerializer == null) {
            // lazy initialize to avoid recursions
            assert foreign == true : "We did something wrong in configuring this field, the serializer should always be set unless this was a foreign field";
            this.admeSerializer = ADMEConfigUtils.findADMESerializerForField(getForeignFieldConfig().getJavaField(), isNullable());
        }
        return admeSerializer;
    }

    public void setADMESerializer(ADMESerializer admeSerializer) {
        this.admeSerializer = admeSerializer;
    }

    public String getColumnName() {

        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getFallbackEnumName() {
        return fallbackEnumName;
    }

    public void setFallbackEnumName(String fallbackEnumName) {
        this.fallbackEnumName = fallbackEnumName;
    }
}




Java Source Code List

com.danielesegato.adme.ADME.java
com.danielesegato.adme.annotation.ADMEEntity.java
com.danielesegato.adme.annotation.ADMEField.java
com.danielesegato.adme.annotation.ADMEIndexConstraint.java
com.danielesegato.adme.config.ADMEConfigUtils.java
com.danielesegato.adme.config.ADMEEntityConfig.java
com.danielesegato.adme.config.ADMEFieldConfig.java
com.danielesegato.adme.config.ADMEIndexConstraintConfig.java
com.danielesegato.adme.config.OnForeignUpdateDelete.java
com.danielesegato.adme.config.SQLiteType.java
com.danielesegato.adme.db.ADMESerializerMapping.java
com.danielesegato.adme.db.ADMESerializer.java
com.danielesegato.adme.db.ContentProviderUris.java
com.danielesegato.adme.db.SQLiteContentProvider.java
com.danielesegato.adme.db.serializer.BaseADMESerializer.java
com.danielesegato.adme.db.serializer.BigDecimalADMESerializer.java
com.danielesegato.adme.db.serializer.BooleanADMESerializer.java
com.danielesegato.adme.db.serializer.BooleanObjectADMESerializer.java
com.danielesegato.adme.db.serializer.CurrencyADMESerializer.java
com.danielesegato.adme.db.serializer.DateAsStringADMESerializer.java
com.danielesegato.adme.db.serializer.DateAsTimestampADMESerializer.java
com.danielesegato.adme.db.serializer.DoubleADMESerializer.java
com.danielesegato.adme.db.serializer.DoubleObjectADMESerializer.java
com.danielesegato.adme.db.serializer.EnumIntADMESerializer.java
com.danielesegato.adme.db.serializer.EnumStringADMESerializer.java
com.danielesegato.adme.db.serializer.IntADMESerializer.java
com.danielesegato.adme.db.serializer.IntObjectADMESerializer.java
com.danielesegato.adme.db.serializer.LongADMESerializer.java
com.danielesegato.adme.db.serializer.LongObjectADMESerializer.java
com.danielesegato.adme.db.serializer.StringADMESerializer.java
com.danielesegato.adme.provider.ADMEContentProviderComponent.java
com.danielesegato.adme.provider.ADMEContentProvider.java
com.danielesegato.adme.utils.DateHelper.java
com.danielesegato.adme.utils.SQLStringHelper.java
com.danielesegato.adme.utils.SQLiteScriptParser.java
com.danielesegato.demo.adme.ADMEDemoMainActivity.java
com.danielesegato.demo.adme.NavigationDrawerFragment.java