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

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

Introduction

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

Prototype

public Object getValue() 

Source Link

Document

Gets the value from the pair.

Usage

From source file:metrics.sink.MetricsTable.java

private void dumpEntry(ID id, Collection<DefaultKeyValue> properties) {
    if (!headersWerePrint) {
        printHeaders();//from ww  w .  ja  v a  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();//from  ww  w  .ja  va  2s  . c om
        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);
        }

    }
}