Java tutorial
/******************************************************************************* * Educational Online Test Delivery System * Copyright (c) 2013 American Institutes for Research * * Distributed under the AIR Open Source License, Version 1.0 * See accompanying file AIR-License-1_0.txt or at * http://www.smarterapp.org/documents/American_Institutes_for_Research_Open_Source_Software_License.pdf ******************************************************************************/ package org.opentestsystem.delivery.testreg.upload; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.apache.poi.ss.usermodel.Row; public class RowMetadataImpl implements RowMetadata { private final int rowNum; private final String rowStyle; private RowErrorType errorType; public enum RowErrorType { FATAL_ERROR, RECORD_ERROR, WARNING } public RowMetadataImpl(final Row row) { // Excel Rows are 0 based so add 1 this(row.getRowNum() + 1, row.getRowStyle() != null ? row.getRowStyle().toString() : null); } public RowMetadataImpl(final int rowNum, final String rowStyle) { this.rowNum = rowNum; this.rowStyle = rowStyle; this.errorType = RowErrorType.RECORD_ERROR; } public RowMetadataImpl(final int rowNum, final String rowStyle, final RowErrorType errorType) { super(); this.rowNum = rowNum; this.rowStyle = rowStyle; this.errorType = errorType; } @Override public int getRowNum() { return this.rowNum; } @Override public String getRowStyle() { return this.rowStyle; } /** * @return the errorType */ @Override public RowErrorType getErrorType() { return this.errorType; } /** * @param errorType the errorType to set */ @Override public void setErrorType(final RowErrorType errorType) { this.errorType = errorType; } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } }