Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ************************************************************************
 #  DivConq
 #  Copyright:
 #    Copyright 2014 eTimeline, LLC. All rights reserved.
#  License:
#    See the license.txt file in the project's top-level directory for details.
#  Authors:
#    * Andy White
************************************************************************ */


Struct is a very fundamental concept in DivConq and used throughout. The Struct system is similar to JSON or YAML, where your principle elements are RecordStruct which is like Object, ListStruct which is like Array and ScalarStruct which is like a value.

Quick introduction to Struct use:

import static divconq.struct.StructUtil.*;

 // create records, fields and lists easily
 Struct rec = record(
    field("Name", "Fred"),
    field("Age", 49),
    field("FavoriteFoods", list("pizza", "cereal", "lima beans"))

 // output as JSON

 // output as formatted JSON

 // validate the structure follows the schema

Struct has a schema system by which to validate divconq.schema. The dcSchema system allows you to extend/customize data types. Each instance of Struct also has an optional datatype so while Struct is mostly like JSON it can be used with YAML too.

Struct is used throughout DivConq.

  • Disconnected Result Sets from data base
  • DivConq RPC calls (Web Services)
  • On the DivConq Bus (server to server communication)
  • DivConq scripting system

Support for streaming parsing of structures is available divconq.struct.builder.

package divconq.struct;

New to GrepCode? Check out our FAQ X