All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.altova.text.tablelike.flf.Table Maven / Gradle / Ivy

////////////////////////////////////////////////////////////////////////
//
// Table.java
//
// This file was generated by MapForce 2017sp2.
//
// YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
// OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
//
// Refer to the MapForce Documentation for further details.
// http://www.altova.com/mapforce
//
////////////////////////////////////////////////////////////////////////

package com.altova.text.tablelike.flf;

import com.altova.text.tablelike.ISerializer;

public class Table extends com.altova.text.tablelike.Table
{
	private int m_lineEnd = 0;

	public Table(com.altova.typeinfo.TypeInfo tableType, int lineEnd) 
	{
		super(false);
		this.tableType = tableType;
		this.m_lineEnd = lineEnd;
		init();
	}

	public Format getFormat() { return ((Serializer) m_Serializer).getFormat(); }

	protected ISerializer createSerializer()
	{
		return new Serializer(this,m_lineEnd);
	}

	private static int getLength(com.altova.typeinfo.MemberInfo member)
	{
		com.altova.typeinfo.TypeInfo ti = member.getDataType();
		if (ti.facets != null)
        {
    		for( int iFacet = 0 ; iFacet < ti.facets.length ; ++iFacet )
    		{
    			if (ti.facets[iFacet].facetName.equals("length") || ti.facets[iFacet].facetName.equals("maxLength"))
    				return ti.facets[iFacet].intValue; 
    		}
        }
		return Integer.MAX_VALUE;
	}

	protected void initHeader(com.altova.text.tablelike.Header header)
	{
		for( int iMember = 0 ; iMember < tableType.getMembers().length ; ++iMember )
		{
			com.altova.typeinfo.MemberInfo member = tableType.getMembers()[iMember];
			header.add(
				new com.altova.text.tablelike.ColumnSpecification(member.getLocalName(), getLength(member.getDataType().getMembers()[0])));
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy