Skip to content
liangjh edited this page Sep 1, 2012 · 6 revisions

Introduction

On this page we will demonstrate examples on how you can utilize these libraries.

Code Samples

  1. Constructing a data container

Will construct a very simple data container. The first step is to define the meta definition. From that point, we can construct the data container, and then add a CDataRow object to the container.

// Create meta-definition String[] columnNames = new String[] {"account_id", "owner", "balance", "rate"}; Class[] columnTypes = new Class[] {String.class, String.class, Double.class, Double.class}; String[] primaryKeys = new String[] {"account_id"}; CRowMetaData metaDef = new CRowMetaData(columnNames, columnTypes, primaryKeys);

// Create a row of data CDataRow row = new CDataRow(); row.setRawData(new Object[] {"asdf1234", "Casper", new Double(25000000.0), new Double(0.650434)});

// Create data container , set data CDataCacheContainer container = new CDataCacheContainer("mytest", metaDef, new HashMap()); container.addData(new CDataRow[] {row}); `

Clone this wiki locally