Example usage for org.apache.commons.collections.keyvalue DefaultKeyValue getKey

List of usage examples for org.apache.commons.collections.keyvalue DefaultKeyValue getKey

Introduction

In this page you can find the example usage for org.apache.commons.collections.keyvalue DefaultKeyValue getKey.

Prototype

public Object getKey() 

Source Link

Document

Gets the key from the pair.

Usage

From source file:metrics.sink.MetricsTable.java

private void dumpEntry(ID id, Collection<DefaultKeyValue> properties) {
    if (!headersWerePrint) {
        printHeaders();//from   w  ww.j  a  va 2  s.c  om
        headersWerePrint = true;
    }
    Row entryRow = currentSheet.createRow(rowCount++);

    Cell methodSignatureCell = entryRow.createCell(0);
    methodSignatureCell.setCellValue(id.toString());

    Iterator<DefaultKeyValue> iterator = properties.iterator();
    while (iterator.hasNext()) {
        DefaultKeyValue nextKeyVal = iterator.next();

        String property = (String) nextKeyVal.getKey();
        Object value = nextKeyVal.getValue();
        Integer columnIndex = (Integer) columnMapping.getKey(property);

        if (value instanceof Number) {
            Cell cell = entryRow.createCell(columnIndex);
            cell.setCellValue((Double) value);
            cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);

        } else {
            Cell cell = entryRow.createCell(columnIndex);
            cell.setCellValue((String) value);
            cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        }
    }
}

From source file:br.ufal.cideei.util.count.MetricsTable.java

private void dumpEntry(String method, Collection<DefaultKeyValue> properties) {
    if (!headersWerePrint) {
        printHeaders();// ww  w .j  av a2  s  . co  m
        headersWerePrint = true;
    }
    Row entryRow = sheet.createRow(rowCount++);

    Cell methodSignatureCell = entryRow.createCell(0);
    methodSignatureCell.setCellValue(method);

    Iterator<DefaultKeyValue> iterator = properties.iterator();
    while (iterator.hasNext()) {
        DefaultKeyValue nextKeyVal = iterator.next();

        String property = (String) nextKeyVal.getKey();
        Object value = nextKeyVal.getValue();
        Integer columnIndex = (Integer) columnMapping.getKey(property);

        if (value instanceof Double) {
            Cell cell = entryRow.createCell(columnIndex);
            cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
            cell.setCellValue((Double) value);

        } else {
            Cell cell = entryRow.createCell(columnIndex);
            cell.setCellValue((String) value);
            cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        }

    }
}