de.vandermeer.asciitable.v2.row.ContentRow Maven / Gradle / Ivy
/* Copyright 2014 Sven van der Meer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.vandermeer.asciitable.v2.row;
import org.apache.commons.lang3.builder.ToStringBuilder;
import de.vandermeer.asciitable.commons.ObjectToStringStyle;
import de.vandermeer.asciitable.commons.TableException;
/**
* A table row representing a content row.
*
* @author Sven van der Meer <[email protected]>
* @version v1.0.0 build 160319 (19-Mar-16) for Java 1.7
* @since v0.2.0
*/
public class ContentRow implements V2_Row {
/** Array with content if the row is a content row, null otherwise. */
private Object[] columns;
/** Array with advice on the alignment of text in a column. */
private char[] alignment;
/** Array with advice on padding for each column - padding left/right. */
private int[] padding;
/**
* Returns a new content table row
* @param columns content in form of columns
* @param padding the default padding as number of padding characters left and right
* @throws TableException if columns are blank
*/
public ContentRow(Object[] columns, int padding) throws TableException {
if(columns==null){
throw new TableException("wrong columns argument", "empty column array");
}
this.columns = columns;
this.alignment = new char[this.columns.length];
for(int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy