@groovy.transform.CompileStatic abstract class GloopObject<T> extends groovy.lang.GroovyObjectSupport implements GloopTreeNodeObject, java.lang.Cloneable, Marshallable, java.io.Serializable
Base class for all gloop variables
T
- the type of variable that this object storesModifiers | Name | Description |
---|---|---|
static java.lang.String |
DEFAULT_NAMESPACE |
Type | Name and description |
---|---|
java.lang.String |
alias variable name alias that's used when serialising as json/xml/anything else. |
boolean |
allowNull shows whether null is allowed |
boolean |
array used to determine whether the variable is an array |
java.lang.String |
comments comments, used for UIs |
java.lang.Object |
defaultValue default value, used when the value is null |
boolean |
deprecated Use to identify if a particular gloop object was deprecated |
java.lang.Integer |
maxArraySize maximum array size |
java.lang.Integer |
minArraySize minimum array size |
java.lang.String |
name variable name |
java.lang.String |
namespaceUri namespace of this object (used when writing xml) |
java.lang.String |
namespaceUri |
java.lang.String |
outputExpression |
java.lang.String |
outputExpressionLanguage groovy expression or closure that's used to format the data before being serialized to xml or json |
GloopObject |
parent parent variable (model) - not used for UI |
boolean |
required used to determine whether to show the variable in json/xml, regardless if the value is null |
long |
timestamp the timestamp (ms) when the value was modified. |
java.lang.String |
validationExpression expression that is used to validate a given value before it's set to the gloopObject |
java.lang.String |
validationExpressionLanguage |
java.lang.Object |
value |
java.lang.Object |
value |
Constructor and description |
---|
GloopObject
() |
GloopObject
(java.lang.Class typeClass) |
GloopObject
(java.lang.String name, java.lang.Object value, java.lang.Class typeClass) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
asJson(java.io.Writer writer, boolean pretty, boolean includeNulls, boolean includeRoot) utility method to marshall the object as regular json @return |
|
java.lang.String |
asJson(boolean includeNulls) |
|
java.lang.String |
asJson(boolean includeNulls, boolean includeRoot) utility method to marshall the object as regular json @return |
|
java.lang.Object |
asType(java.lang.Class asType) Used by groovy at runtime when the as keyword is used |
|
java.lang.String |
asXml(boolean insertHeader, java.util.Map declaredNamespaces, boolean includeNamespaces, boolean includeNulls) utility method to marshall the object as regular xml @return |
|
void |
asXml(java.io.Writer writer, boolean insertHeader, java.util.Map declaredNamespaces, boolean includeNamespaces, boolean includeNulls) |
|
java.lang.String |
asYaml(boolean includeNulls, boolean includeRoot) utility method to marshall the object as regular yaml @return |
|
java.lang.String |
asYaml(boolean includeNulls) |
|
void |
asYaml(java.io.Writer writer, boolean includeNull) |
|
java.lang.Object |
call() method to allow overloading of the a() operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
protected GloopObject |
clone(GloopObject clone) |
|
java.lang.Object |
clone() clones this object @return |
|
java.lang.String |
commentsString() used by UI @return |
|
protected T |
convertValue(java.lang.Object input) used to try and convert the given value to whatever the gloop object requires |
|
java.lang.Object |
each(groovy.lang.Closure c) Utility method for the each closure, to make coding easier |
|
java.lang.Object |
eachWithIndex(groovy.lang.Closure c) Utility method for the eachWithIndex closure, to make coding easier |
|
protected java.lang.String |
escapeGloopDocParameter(java.lang.String parameter) |
|
java.lang.Object |
find(groovy.lang.Closure c) Utility method for the find closure, to make coding easier |
|
int |
findIndexOf(groovy.lang.Closure c) Utility method for the findIndexOf closure, to make coding easier |
|
static GloopObject |
fromGloopDoc(java.lang.String gloopDoc) |
|
static GloopObject |
fromJson(java.lang.String json) |
|
static GloopObject |
fromJson(java.io.InputStream json) |
|
static GloopObject |
fromJson(java.io.Reader json) |
|
static GloopObject |
fromXml(java.lang.String xml) |
|
static GloopObject |
fromXml(java.io.InputStream xml) |
|
static GloopObject |
fromXml(java.io.Reader xml) |
|
static GloopObject |
fromYaml(java.lang.String yaml) |
|
static GloopObject |
fromYaml(java.io.InputStream yaml) |
|
static GloopObject |
fromYaml(java.io.Reader yaml) |
|
java.lang.String |
getAlias() |
|
java.lang.Object |
getAt(int index) method to allow overloading of the a[b] operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
java.lang.Object |
getAt(long index) |
|
java.lang.String |
getFilename() |
|
java.lang.Object |
getFormattedValue(java.lang.String type, java.util.Map extraParams) Used by the json and xml serializers. |
|
java.lang.String |
getGloopDocString(int indent) used to generate the gloop doc string used by java/groovy code for UI decoration @return |
|
protected java.lang.String |
getGloopDocType() used to generate the gloop doc string used by java code for UI decoration @return |
|
java.lang.String |
getNamespaceUri() |
|
protected java.lang.String |
getPathName(java.util.List<GloopObject> processedParents) used to get the full 'path' of this object @return |
|
java.lang.String |
getPathName() |
|
java.lang.Object |
getRawDefaultValue() |
|
java.lang.Object |
getRawValue() |
|
java.lang.String |
getType() Simple string representation of the class this object can store @return |
|
java.lang.Class |
getTypeClass() The class this object stores @return |
|
java.lang.Object |
getValue() returns the value, or the value in the array @return |
<T> |
T |
getValue(java.lang.Class<T> asType) Uses the gloop object converter registry to try and return the value as an instance of whatever class is passed in |
|
java.lang.String |
iconName() used by UI @return |
|
boolean |
isEmpty() |
|
boolean |
isNullValue() helper method to determine whether the value is null the value must be null or an empty collection @return |
|
java.util.Iterator |
iterator() implemented to allow use of methods that expect a java.util.Iterable |
|
java.lang.Object |
leftShift(java.lang.Object shiftin) method to allow overloading of the << operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
java.lang.String |
marshall() utility method to marshall the object to the gloop json format @return |
|
java.lang.Object |
minus(java.lang.Object x) method to allow overloading of the - operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
java.lang.Object |
parseVal(java.lang.Object val) method that is used to try and see if a given value can successfully be set in this object. |
|
java.lang.Object |
plus(java.lang.Object x) method to allow overloading of the + operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
java.lang.Object |
putAt(int index, java.lang.Object shiftin) method to allow overloading of the a[b] = c operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
java.lang.Object |
rightShift(java.lang.Object shiftout) method to allow overloading of the >> operator http://groovy-lang.org/operators.html#Operator-Overloading @return |
|
void |
setArray(boolean array) Set the object to an array. |
|
void |
setName(java.lang.String name) |
|
void |
setNamespaceUri(java.lang.String namespaceUri) |
|
protected void |
setTypeClass(java.lang.Class typeClass) |
|
void |
setValue(java.lang.Object value) sets the value of this gloop object to the object passed in, or an object that represents the same value of the type that this gloop object expects. parseVal is used to ensure collections are used when this is an array, and that a POJO is passed in when it's not an array. convertVal is used to do the conversion of the passed in object to the value that will be either added to the collection or set as the actual value |
|
long |
size() utility method to determine the size of the object. |
|
protected void |
throwClassCastException(java.lang.Object val) handy method for throwing a class cast exception |
|
java.lang.String |
toString() |
|
java.lang.String |
toolTipText() used by UI @return |
|
java.lang.String |
treeString() used by UI @return |
|
java.lang.String |
treeSuffix() |
|
void |
validate() method used to validate the value. |
|
protected void |
validateValue() should be used by subclasses to perform their own special checks |
Methods inherited from class | Name |
---|---|
class groovy.lang.GroovyObjectSupport |
groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll(), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String) |
variable name alias that's used when serialising as json/xml/anything else. Normally the name is ok, but if the name contains characters or a sequence that renders it in valid for gloop, then the name is sanitised for use in gloop code and the alias is used when serialising to xml/json/yaml
shows whether null is allowed
used to determine whether the variable is an array
comments, used for UIs
default value, used when the value is null
Use to identify if a particular gloop object was deprecated
maximum array size
minimum array size
variable name
namespace of this object (used when writing xml)
groovy expression or closure that's used to format the data before being serialized to xml or json
parent variable (model) - not used for UI
used to determine whether to show the variable in json/xml, regardless if the value is null
the timestamp (ms) when the value was modified.
expression that is used to validate a given value before it's set to the gloopObject
utility method to marshall the object as regular json @return
utility method to marshall the object as regular json @return
Used by groovy at runtime when the as keyword is used @return
utility method to marshall the object as regular xml @return
utility method to marshall the object as regular yaml @return
method to allow overloading of the a() operator http://groovy-lang.org/operators.html#Operator-Overloading @return
clones this object @return
used by UI @return
used to try and convert the given value to whatever the gloop object requires
Utility method for the each closure, to make coding easier @return
Utility method for the eachWithIndex closure, to make coding easier @return
Utility method for the find closure, to make coding easier @return
Utility method for the findIndexOf closure, to make coding easier @return
method to allow overloading of the a[b] operator http://groovy-lang.org/operators.html#Operator-Overloading @return
Used by the json and xml serializers. The outputExpression could a simple expression that does something with the given value 'val', or the expression can return a method for the given serialization 'type'. For example, if the expression is: xml = val.toString().toLowerCase() json = val.toString().toUpperCase() csv = val.toString().trim() for csv and tab delimited files txt = val.format() for fixed width files Then the value will be written to json as upper case, but as lower case for xml. Alternatively the expression can ignore the type, and be: val.toString().toLowerCase() This will then write the value as lower case for all output format types. This method will be handy for date objects, so they can be formatted with a given value before being written. If the object is an array, the expression will be called for each entry. Variables are: * val - the actual value * type - the type * index - the array index (only available when the object is an array) * collection - the entire collection (only available when the object is an array) @return
used to generate the gloop doc string used by java/groovy code for UI decoration @return
used to generate the gloop doc string used by java code for UI decoration @return
used to get the full 'path' of this object @return
Simple string representation of the class this object can store @return
The class this object stores @return
returns the value, or the value in the array @return
Uses the gloop object converter registry to try and return the value as an instance of whatever class is passed in @return
used by UI @return
helper method to determine whether the value is null the value must be null or an empty collection @return
implemented to allow use of methods that expect a java.util.Iterable
method to allow overloading of the << operator http://groovy-lang.org/operators.html#Operator-Overloading @return
utility method to marshall the object to the gloop json format @return
method to allow overloading of the - operator http://groovy-lang.org/operators.html#Operator-Overloading @return
method that is used to try and see if a given value can successfully be set in this object. If it can be, the allowed value is returned. This does all the heavy lifting with ensuring that valid arrays/collections are passed in at the right times (when the gloopobject is an array) @return
method to allow overloading of the + operator http://groovy-lang.org/operators.html#Operator-Overloading @return
method to allow overloading of the a[b] = c operator http://groovy-lang.org/operators.html#Operator-Overloading @return
method to allow overloading of the >> operator http://groovy-lang.org/operators.html#Operator-Overloading @return
Set the object to an array. Also converts the value to a collection and back if necessary
sets the value of this gloop object to the object passed in, or an object that represents the same value of the type that this gloop object expects. parseVal is used to ensure collections are used when this is an array, and that a POJO is passed in when it's not an array. convertVal is used to do the conversion of the passed in object to the value that will be either added to the collection or set as the actual value
utility method to determine the size of the object. Only works when it's an array @return
handy method for throwing a class cast exception
used by UI @return
used by UI @return
method used to validate the value. Checks * allowNull * minArraySize * maxArraySize if the object has a validation expression, the expression is used to check every value and return true/false if it's valid or not. For example, the following expression is used to ensure that the date in this object is on the 12th, 13th, or 30th day of the month def x = val.format('dd') x.startsWith('12') || x.startsWith('13') || x.startsWith('30') @return
should be used by subclasses to perform their own special checks
Groovy Documentation