Cog Recipes

Overview

These recipes revolve around the Cog framework and its XML file format.

Since data manipulation and conversion is a primary function of Cog, these sorts of tasks are addressed as well.

Cog v5 is in com.partnersoft.v5.boots.cog.structure.Cog, and Cog v4 is in com.partnersoft.cog.Cog.

Do not use the v3 version of Cog in the Staker module unless absolutely necessary.

Conventions

All recipe code is in the Java language. They should trivially convert to Groovy and easily convert to Jython or Beanshell.

All recipes assume a predefined variable of type Cog named data. For v5 this could be initialized like this:

Cog data = new Cog();

Data Conversion

Convert a property to a String

// get the value as a String, regardless of its stored type
String value = data.getString("propertyName");

// set it back as a String in the original structure
data.putString("propertyName", value);

Table Of Contents

Previous topic

Partner Development Cookbook

Next topic

File Reference

This Page