Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Gloop model icon

Gloop models

Gloop 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.

Gloop models, like Java objects, contain properties4. They are analogous to JavaBeans in that they are basically objects comprised of properties such as Strings, Integers, Dates, Booleans, and so on. However, Gloop 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 = ❤️

Gloop models are also very easy to manipulate using Groovy code. The code you would write to work with JavaBeans and Gloop models is the same. For example, the code below works for JavaBeans and Gloop models:

1
2
3
4
5
6
7
// Say you have a JavaBean with a property called stringProperty 
// or a Gloop model with a property called stringProperty
myJavaBeanOrGloopModel.stringProperty = 'World!'
println "Hello, ${myJavaBeanOrGloopModel.stringProperty}!"

// Add an entry to a Gloop model or JavaBean array property:
myJavaBeanOrGloopModel.myStringArray << 'Earth!'

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
// Enable extra properties in 'myGloopModel'
myGloopModel.setAllowExtraProperties(true)

// Add a new property called 'extraProperty' to 'myGloopModel'
myGloopModel.extraProperty = 'Hello, world!'

  1. Like Java objects. 

  2. Such as CSV and fixed width text files with the help of Gloop services

  3. Such as File to InputStream, String to Integer, etc. 

  4. or in OOP, member variables