io.realm.RealmFieldType Java Examples

The following examples show how to use io.realm.RealmFieldType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RealmBarDataSet.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, int xIndex) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(values,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    } else {
        float value = dynamicObject.getFloat(mValuesField);
        return new BarEntry(value,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    }
}
 
Example #2
Source File: RealmBarDataSet.java    From JNChartDemo with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, int xIndex) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(values,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    } else {
        float value = dynamicObject.getFloat(mValuesField);
        return new BarEntry(value,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    }
}
 
Example #3
Source File: RealmBarDataSet.java    From MPAndroidChart-Realm with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, float x) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mYValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mYValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(
                mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField), values);
    } else {
        float value = dynamicObject.getFloat(mYValuesField);
        return new BarEntry(mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField), value);
    }
}
 
Example #4
Source File: HtmlBuilder.java    From realm-browser-android with MIT License 5 votes vote down vote up
public void showTableStructure(DynamicRealm dynamicRealm) {
    RealmObjectSchema realmObjectSchema = dynamicRealm.getSchema().get(simpleTableName);
    Set<String> fieldNames = realmObjectSchema.getFieldNames();
    stringBuilder.append("<div class=\"content\">").append("<table class=\"dataTable\">")
            .append("<th>Column Name</th><th>Type</th>");
    for (String fieldName : fieldNames) {
        RealmFieldType realmFieldType = realmObjectSchema.getFieldType(fieldName);
        stringBuilder.append("<tr>")
                .append("<td>").append(fieldName).append("</td>")
                .append("<td>").append(realmFieldType.name()).append("</td>")
                .append("</tr>");
    }
    stringBuilder.append("</table></div>");
}