Data models
Data models are used by Gloop to store application data in memory1 while your applications are running. They are very good at reading and writing themselves to and from XML, JSON, YAML, common flat file formats2, SQL databases via SQL services, and others more. They are also great at automatically converting various types of Java objects into the type the Gloop object itself expects3.
Data models, like Java objects, contain properties4.
They are analogous to JavaBeans in that they are basically objects comprised of properties such as
String
s, Integer
s, Date
s,
Boolean
s, and so on. However, Data model properties are also Gloop objects. Gloop
objects contain extra functionality and a common set of properties to make configuring Gloop objects easier. Below is a
list of the types of Gloop objects available in alphabetical order and their counterparts in Java:
Gloop object type | Wrapped Java equivalent |
---|---|
BigDecimal |
java.math.BigDecimal |
BigInteger |
java.math.BigInteger |
Boolean |
java.lang.Boolean |
Byte |
java.lang.Byte |
ByteArray |
byte [] |
Character |
java.lang.Character |
Date |
java.util.Date |
Double |
java.lang.Double |
Float |
java.lang.Float |
Integer |
java.lang.Integer |
Long |
java.lang.Long |
Model |
N/A |
Object |
java.lang.Object |
Short |
java.lang.Short |
String |
java.lang.String |
Gloop + Groovy = ❤️
Data models are also very easy to manipulate using Groovy code. The code you would write to work with JavaBeans and Data models is the same. For example, the code below works for JavaBeans and data models:
1 2 3 4 5 6 7 |
|
You can also dynamically add new properties to a Gloop model. To do this,
Allow Extra Properties
must be set to true
. For example:
1 2 3 4 5 |
|
Data models can also easily be manipulated using any of the supported languages in GraalVM.