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

org.tentackle.wurblet.ColumnLengths Maven / Gradle / Ivy

There is a newer version: 21.16.1.0
Show newest version
// wurblet generated by Wurbelizer 2.0.6, see http://www.wurbelizer.org

package org.tentackle.wurblet;

import org.tentackle.buildsupport.*;
import java.util.*;
import java.io.*;
import org.tentackle.common.*;
import org.wurbelizer.wurbel.*;
import org.tentackle.model.*;
import org.wurbelizer.wurblet.*;


public class ColumnLengths extends ModelWurblet {

  @Override
  public void run() throws WurbelException {
    super.run();
    try {
      // ----------------- begin wurblet code -----------------

    /**
     * Tentackle - http://www.tentackle.org
     *
     * This library is free software; you can redistribute it and/or
     * modify it under the terms of the GNU Lesser General Public
     * License as published by the Free Software Foundation; either
     * version 2.1 of the License, or (at your option) any later version.
     *
     * This library is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     * Lesser General Public License for more details.
     *
     * You should have received a copy of the GNU Lesser General Public
     * License along with this library; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     */



    /**
     * Generate code to define the cokumn lengths.
     *
     * usage:  @wurblet  ColumnLengths [--model=] [--noif]
     *
     *          is the mapping description
     *         --noif if not part of an interface (adds "public static final")
     */

    String lead = getOption("noif") == null ? "" : "public static final ";

    for (Attribute attr: getEntity().getAttributes())  {
      if ((attr.getDataType() == DataType.STRING ||
           attr.getDataType() == DataType.APPLICATION && attr.getInnerType() == DataType.STRING) &&
          attr.getSize() != null && !attr.getOptions().isNoConstant() && !attr.getOptions().isFromSuper())  {
            out.print(source[0]); // 38:2 = "  /** maximum number of characters for ..."
            out.print(attr);
            out.print(source[1]); // 40:48 = "'. */  "
            out.print(lead);
            out.print(source[2]); // 41:10 = "int CL_"
            out.print(attr.getJavaName().toUpperCase());
            out.print(source[3]); // 41:53 = " = "
            out.print(attr.getSize());
            out.print(source[4]); // 41:74 = ";"
      }
    }

      // ----------------- end wurblet code -----------------
    }
    catch (Exception ex) {
      throw new WurbelException("wurblet " + this + " failed", ex);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy