blob: 45f433466541d03ae318241fceb13bcbc82265b2 [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2012, 2021 Original NatTable authors and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Original NatTable authors and others - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.ecommons.waltable.layer.cell;
import org.eclipse.statet.ecommons.waltable.data.IRowDataProvider;
import org.eclipse.statet.ecommons.waltable.layer.LabelStack;
/**
* Adds the Java class name of the cell's data value as a label.
*/
public class ClassNameConfigLabelAccumulator implements IConfigLabelAccumulator {
private final IRowDataProvider<?> dataProvider;
public ClassNameConfigLabelAccumulator(final IRowDataProvider<?> dataProvider) {
this.dataProvider= dataProvider;
}
@Override
public void accumulateConfigLabels(final LabelStack configLabel, final long columnPosition, final long rowPosition) {
final Object value= this.dataProvider.getDataValue(columnPosition, rowPosition, 0, null);
if (value != null) {
configLabel.addLabel(value.getClass().getName());
}
}
}