Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Gloop Object Types

Introduction

As stated in the Gloop Models page, Gloop Models are like JavaBeans in that they have fields (or in Java-speak, properties). This page describes the types of properties you can add to a Gloop Model, and what types of objects or values they can store.

A Gloop Object is an instance of any of those types. Gloop Objects of all types have extra properties of their own, which we will call meta-properties. These meta-properties assist Gloop in reading and writing to XML, JSON, and YAML. They also contain meta-properties which help enrich the user interfaces of Coder Studio and Coder Cloud, as well as other meta-properties that help better describe Gloop APIs when they're exposed as REST and SOAP.

Available Gloop Object Types

Below is a table that shows the types of properties that a model can store (in alphabetical order). Notice that the list contains an Object type. This means that a Gloop Object isn't limited to having a basic type; you could use a Gloop Object Object1 to reference a Java or Groovy object (via setting its class name).

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

Meta Properties

This section describes all of the meta-properties and lists which objects support them. The meta-properties below will help your Gloop Objects and Gloop Models perform self-validation, as well as help you when reading and writing Gloop data in various formats.

Some meta-properties are only present in certain Gloop Object types. Refer to the table below to know which types support which meta-properties (X's indicate support):

Gloop Object Type Name Alias Comments Default Value Required Allow Null Array Minimum Array Size Maximum Array Size Validation Expression Output Expression Namespace URI Choices Allow Other Values Minimum Maximum XML Attribute Date Formats XML Type Allow Extra Properties Reference Object Class Name Minimum Length Maximum Length
BigDecimal X X X X X X X X X X X X X X X X X
BigInteger X X X X X X X X X X X X X X X X X
Boolean X X X X X X X X X X X X X
Byte X X X X X X X X X X X X X X X X X
ByteArray X X X X X X X X X X X X
Character X X X X X X X X X X X X X X X X X
Date X X X X X X X X X X X X X X X
Double X X X X X X X X X X X X X X X X X
Float X X X X X X X X X X X X X X X X X
Integer X X X X X X X X X X X X X X X X X
Long X X X X X X X X X X X X X X X X X
Model X X X X X X X X X X X X X
Object X X X X X X X X X X X X X
Short X X X X X X X X X X X X X X X X X X
String X X X X X X X X X X X X X X X X X

Name

The name of the Gloop Object. This is what you will see in the Coder UI, and is normally used to access the property in your Groovy code. Think of this as the name of your variable.

If the name is a reserved Java or Groovy keyword, or an invalid Java or Gloop variable name, then the meta-property Alias will contain the original name value (which is used when serializing to XML, JSON, YAML, etc). The new name will be prefixed with an underscore, and should be used when manipulating Gloop Objects in Groovy code.

Alias

This is the value that's used as the variable's name (name in JSON/YAML, attribute/element name in XML) when serialising as JSON, XML, YAML, flat files, etc. Normally the name is okay, but if the name contains characters or a sequence that renders it invalid for Gloop, then the name is sanitised for use in Gloop code and the alias is used when serialising.

When your Gloop property name requires an alias, the alias will be shown after the name in brackets in Coder. Below is a screenshot of a property in Coder, and it's representation in JSON and XML. To access the property in the screenshot below in Groovy code, myModel._1invalidProperty would be used. However when the property is read and written, 1invalidProperty would be used.

Coder showing a Gloop Property with its XML and JSON in Coder Studio

Coder showing a Gloop Property with its XML and JSON in Coder Cloud

Comments

You can add comments to document any extra information about a Gloop Object.

When your Gloop Model property has comments, they appear after the name and // in Coder (see 1 below). Comments that are added to properties automatically end up in your Gloop API files (2 below shows how comments appear in your SOAP API , and 3 below shows how comments appear in your REST API).

Coder showing a Gloop Property comment with it's Swagger and WSDL content

Default Value

If the Gloop object has no actual value (value == null), then the configured Default Value is used. This is the same as initialising a field in Java, for example:

1
    Integer myNumber = 4;

All Gloop Object types, except Gloop Models, can have default values.

Required

This is used to determine whether to show the variable in XML, JSON, or YAML, regardless if the value is null. If this variable has a null value and required is set to false, then it will not be serialised. If required is true, then it will be serialised as follows:

JSON
1
"myGloopProperty": null
XML
1
<myGloopProperty />
YAML
1
myGloopProperty:

Allow Null

This will determine whether the Gloop Object allows null values or not. Gloop validates the objects' Allow Null property before invoking Gloop Services or Groovy Services. At runtime, if a property has an Allow Null value of false and its value is null, an Exception will be thrown. In the screenshot below, you will notice that while coding, when a property has a false Allow Null value, it will shown in bold (1). Coder will also show an error next to the step in your Gloop Service while you're coding your integrations if the value appears to be null (2).

Coder showing a Gloop Property with *Allow Null* == false

Array

This tells Gloop whether the property should be treated as an array or not. Array properties can be mapped to Gloop Cursors. When a property is marked as an array, Gloop holds the values in a java.util.List. Also, if you look closely, your property will appear with array brackets on the bottom right corner of its icon.

Coder Studio showing the Gloop Array Badge

Array Ninja[]

Gloop allows you to map arrays to non-arrays and vice versa. When mapping an array to a non-array, the first element in the array will be mapped. When mapping a non-array to an array, the array will be cleared, and the mapped value will be the first entry in the newly-cleared array. You also have three ways in which to toggle whether a Gloop Object is an array or not. Via (1) the Convert To sub menu (which is activated when right-clicking on a property), (2) the Properties table, or by pressing Shift + [. Coder Studio showing the Gloop Array Toggles

Minimum Array Size

This property tells Gloop what the minimum size of the array must be. If the property is empty, then it will not perform this validation. Gloop validates the objects' Minimum Array Size property before invoking Gloop Services. If a property has an array whose size is less than the Minimum Array Size value, an Exception will be thrown.

Maximum Array Size

This property tells Gloop what the maximum size of the array must be. If the property is empty, then it will not perform this validation. Gloop validates the objects' Maximum Array Size property before invoking Gloop Services. If a property has an array whose size is greater than the Maximum Array Size value, an Exception will be thrown.

Validation Expression

This property is used by Gloop to validate the value of the object. The expression must be written in Groovy. If the property is an array, then Gloop will evaluate the expression for every value in the array. Gloop expects the expression to return a boolean. When the expression returns true, Gloop will assume the value is valid. When the expression is executed, Gloop will provide up to four variables:

  • gloopObject

    The actual Gloop Object.

  • val

    This is the actual value to check.

  • index

    If the property is an array, this variable will be the index of the value in the array, otherwise it will be null.

  • collection

    If the property is an array, this variable will be the actual java.util.List; otherwise it will be null.

Examples

To ensure that the year of a certain Gloop Date is the current year, you could do something like:

1
new Date().getYear() == val.getYear()

To ensure that a Gloop Number Object is even, you could do:

1
val % 2 == 0

Output Expression

This is used by Gloop when objects are being written to flat files, XML, JSON, and YAML. This property is particularly useful for formatting Gloop Object values, like formatting numbers such as 1234567 to $1,234,567 or formatting Gloop Date objects to any format you like. If the property is an array, then Gloop will evaluate the expression for every value in the array. The Output Expression could be a simple expression that does something with the given value val, or the expression can return another variable for the given serialization type.

For example:

1
2
3
4
5
6
7
def expressions = [
    xml : val.toString().toLowerCase(),
    json : val.toString().toUpperCase(),
    csv : val.toString().trim(),
    txt : "Hello $val"
    ]
return expressions[ type ]

Using the code above as the value of Output Expression, the value will be written to JSON as upper case, lower case for XML, trimmed for CSV files, and prefixed with Hello for fixed-width flat file values. Alternatively, the expression can ignore the type and be:

1
val.toString().toLowerCase()

This will then write the value as lower case for all output format types. When the expression is executed, Gloop will provide up to five variables:

  • gloopObject

    The actual Gloop Object.

  • val

    This is the actual value to format.

  • index

    If the property is an array, this variable will be the index of the value in the array; otherwise it will be null.

  • collection

    If the property is an array, this variable will be the actual java.util.List; otherwise it will be null.

  • type

    This variable tells you what format the variable will be written to. The values are either txt (for fixed-width file output cursors), csv (for delimited file output cursors), xml, json, or yaml.

Output reuse

Since Output Expressions are written in Groovy, you could place all of your output code in one place, and invoke it from your Output Expression.

Namespace URI

Gloop uses this when converting Gloop Objects to XML, by declaring namespaces when necessary.

Choices

This property can be used to make an object behave like an enum which restricts the values that this Gloop Object will accept. Coder also uses this property when setting variables by displaying the list choices instead of a text area.

Coder showing Gloop Choices

Allow Other Values

This tells Gloop whether the object will allow other values outside of the choices. If this is false and the value of the Object is set to something that is not in the choices list, an Exception will be thrown. If this is true, Coder will display the choices when setting the value of the property but also display a text field which in case you want to set the value to something that isn't in the list of choices.

Coder showing Gloop Choices

Minimum

This is the lowest value this object is allowed to have. At runtime, if the value of this object is less than the Minimum, an Exception will be thrown.

Maximum

This is the highest value this object is allowed to have. At runtime, if the value of this object is greater than the Maximum, an Exception will be thrown.

XML Attribute

This property tells Gloop whether to marshall this Gloop Object as an XML attribute or not. When set to true, a small attribute badge appears on the top left corner of the object's icon in Coder.

Coder showing XML Attribute badge

Date Formats

If you set the value of a Gloop Date to an object that is an instance of java.lang.CharSequence, the Gloop Date will iterate through the list of Java DateFormat patterns until it finds one that is able to parse it to a Date object.

XML Type

This property tells Gloop how to write the Date or String value when being written as XML.

For Dates, values of this property should be any of the following:

  • null
  • dateTime
  • date
  • duration
  • time
  • gYearMonth
  • gMonthDay
  • gYear
  • gMonth
  • gDay

For Strings, possible values are:

Allow Extra Properties

When this property is set to true, the Gloop Model will allow new properties to be added to it at runtime. Many languages refer to classes like these as an Expando class.

Reference

This property is used when you would like a model to inherit properties from another model. In Gloop terms, this means that the model will reference another one (or extend is in Java terms). Having this populated with Allow Extra Properties set to false is the same as having a final Java class.

Object Class Name

Only Object types have this meta-property. This is the class name of the value that the Gloop Object will store. Use this when you want to store an object that none of the other Gloop Object types are compatible with.

Minimum Length

Only String types have this meta-property. This property determines the minimum allowable length of a String value.

Maximum Length

Only String types have this meta-property. This property determines the maximum allowable length of a String value.


  1. A Gloop Object whose type is Object as opposed to the general term Gloop Object, in which the type is unspecified.