Data field reference

This document describes the different types of data fields, that are available in androrm. You can quick jump to any field reference using the respective link in the side menu.

Behold! All data fields come with two functions get() and set(value) that can be used to retrieve or set their value. As these functions are trivial, they won't appear in each reference for a field.


BlobField Since version 0.4

This field represents the byte[] type of Java. It maps to a BLOB field in the database.

BlobField ( )

The constructor which will initialise this field.


BooleanField Since version 0.1

The BooleanField represents the boolean data type of Java. The generated database field is an integer field with a limited length of one. 0 will be used as the value for false and 1 for true.

BooleanField ( )

This constructor will initialize the field to the default value false.


CharField Since version 0.1

The CharField represents the String data type of Java. This field will create a database column of type varchar.

CharField ( )

This zero-argument constructor will initialize the field without any constraints. Also no implicit maximum length of 255 characters is added to the database field definition. SQLite should then handle the correct creation of the field.


CharField ( int maxLength )

This constructor also takes a parameter to limit the maximum length of the field.

maxLength

The maxLength parameter will be used to limit the maximum allowed length for this field. Note, that this number has to be greater than 0 and less then equal to 255. All other numbers will be ignored.


DateField Since version 0.1

The DateField class represents the Date (java.util) data type of Java. As there is no such type available in SQLite, a date will be stored as varchar in the database. But this is something you don't have to care about. All serialization and deserialization is done fully automatic.

DateField ( )

This constructor won't initialize the value of the field to any specific date. In order to work properly, you have to assign a value at some point.


void fromString ( String date )

This methods takes a date formatted as a String and constructs the value for the field. The String has to be in the format: YYYY-MM-DDTHH:MM:SS

date

A String representing a date.


String getDateString ( )

This method will create the string representation of this field's value.


DoubleField Since version 0.1

The DoubleField class represents the Double data type of Java. For the database column the type numeric will be used.

DoubleField ( )

This zero-argument constructor will initialize the field and set it's value to the default of 0.0.


IntegerField Since version 0.1

The IntegerField class represents the Integer data type of Java. For the database column the integer type of SQLite will be used.

IntegerField ( int maxLength )

This zero argument constructor will initialize the field to the default value of 0. The maximum size of the value, will be the default maximum size of the integer field of the SQLite version running on the phone.

maxLength

The maxLength limits the maximum length of this integer. If, for example, set to 3 only integers between 0 and 999 are possible. The maximum value for this parameter is 16. If a value greater than 16 is handed, it will be ignored and 16 will be used.


IntegerField ( )

This constructor initializes the field and also sets a maximum length variable.


LocationField Since version 0.1

The LocationField class represents the Location data type provided by android. The default value for the location will be set to (0.0, 0.0). In the database this field will be mapped to two numeric fields, that represent the latitude and longitude values of the location.

LocationField ( )

This zero-argument constructor will initialize the location value to (0.0, 0.0).

androrm on github

Django is a registered trademark of the Django Foundation. Android is a registered trademark of Google Inc.