DataType.java

/*
** Module   : DataType.java
** Abstract : Enum describing the 4GL data types.
**
** Copyright (c) 2019-2022, Golden Code Development Corporation.
**
** -#- -I- --Date-- --------------------------------------Description---------------------------------------
** 001 CA  20190924 First version.
**     RFB 20191022 Added LegacyResource annotation
** 002 CA  20191024 Added method support levels and updated the class support level.
**         20200521 Shifted implementation to proper legacy enum approach.
** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
**     CA  20220513 Annotated all enum fields, so they can be tracked during conversion, to use the Java name.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program 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 Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
** 
** Additional terms under GNU Affero GPL version 3 section 7:
** 
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
**   terms apply to the works covered under the License.  These additional terms
**   are non-permissive additional terms allowed under Section 7 of the GNU
**   Affero GPL version 3 and may not be removed by you.
** 
**   0. Attribution Requirement.
** 
**     You must preserve all legal notices or author attributions in the covered
**     work or Appropriate Legal Notices displayed by works containing the covered
**     work.  You may not remove from the covered work any author or developer
**     credit already included within the covered work.
** 
**   1. No License To Use Trademarks.
** 
**     This license does not grant any license or rights to use the trademarks
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
**     of Golden Code Development Corporation. You are not authorized to use the
**     name Golden Code, FWD, or the names of any author or contributor, for
**     publicity purposes without written authorization.
** 
**   2. No Misrepresentation of Affiliation.
** 
**     You may not represent yourself as Golden Code Development Corporation or FWD.
** 
**     You may not represent yourself for publicity purposes as associated with
**     Golden Code Development Corporation, FWD, or any author or contributor to
**     the covered work, without written authorization.
** 
**   3. No Misrepresentation of Source or Origin.
** 
**     You may not represent the covered work as solely your work.  All modified
**     versions of the covered work must be marked in a reasonable way to make it
**     clear that the modified work is not originating from Golden Code Development
**     Corporation or FWD.  All modified versions must contain the notices of
**     attribution required in this license.
*/

package com.goldencode.p2j.oo.reflect;

import com.goldencode.p2j.util.*;
import com.goldencode.p2j.oo.lang.*;

import static com.goldencode.p2j.report.ReportConstants.*;
import static com.goldencode.p2j.util.InternalEntry.Type;

/**
 * Business logic (converted to Java from the 4GL source code
 * in Progress/Reflect/DataType.cls).
 */
@LegacyResource(resource = "Progress.Reflect.DataType")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
public final class DataType
extends LegacyEnum
{
   @LegacySignature(type = Type.VARIABLE, name = "AnyType")
   public static final object<? extends DataType> anyType;

   @LegacySignature(type = Type.VARIABLE, name = "Buffer")
   public static final object<? extends DataType> buffer;

   @LegacySignature(type = Type.VARIABLE, name = "Byte")
   public static final object<? extends DataType> byte_;

   @LegacySignature(type = Type.VARIABLE, name = "Character")
   public static final object<? extends DataType> character;

   @LegacySignature(type = Type.VARIABLE, name = "COMHandle")
   public static final object<? extends DataType> comhandle;

   @LegacySignature(type = Type.VARIABLE, name = "DataSet")
   public static final object<? extends DataType> dataSet;

   @LegacySignature(type = Type.VARIABLE, name = "DataSetHandle")
   public static final object<? extends DataType> dataSetHandle;

   @LegacySignature(type = Type.VARIABLE, name = "Date")
   public static final object<? extends DataType> date;

   @LegacySignature(type = Type.VARIABLE, name = "DateTime")
   public static final object<? extends DataType> dateTime;

   @LegacySignature(type = Type.VARIABLE, name = "DateTimeTZ")
   public static final object<? extends DataType> dateTimeTz;

   @LegacySignature(type = Type.VARIABLE, name = "Decimal")
   public static final object<? extends DataType> decimal;

   @LegacySignature(type = Type.VARIABLE, name = "Double")
   public static final object<? extends DataType> double_;

   @LegacySignature(type = Type.VARIABLE, name = "Float")
   public static final object<? extends DataType> float_;

   @LegacySignature(type = Type.VARIABLE, name = "Handle")
   public static final object<? extends DataType> handle;

   @LegacySignature(type = Type.VARIABLE, name = "Int64")
   public static final object<? extends DataType> int64;

   @LegacySignature(type = Type.VARIABLE, name = "Integer")
   public static final object<? extends DataType> integer;

   @LegacySignature(type = Type.VARIABLE, name = "Logical")
   public static final object<? extends DataType> logical;

   @LegacySignature(type = Type.VARIABLE, name = "Longchar")
   public static final object<? extends DataType> longchar;

   @LegacySignature(type = Type.VARIABLE, name = "Memptr")
   public static final object<? extends DataType> memptr;

   @LegacySignature(type = Type.VARIABLE, name = "Object")
   public static final object<? extends DataType> object_;

   @LegacySignature(type = Type.VARIABLE, name = "Raw")
   public static final object<? extends DataType> raw;

   @LegacySignature(type = Type.VARIABLE, name = "Recid")
   public static final object<? extends DataType> recid;

   @LegacySignature(type = Type.VARIABLE, name = "Rowid")
   public static final object<? extends DataType> rowid;

   @LegacySignature(type = Type.VARIABLE, name = "Short")
   public static final object<? extends DataType> short_;

   @LegacySignature(type = Type.VARIABLE, name = "SingleCharacter")
   public static final object<? extends DataType> singleCharacter;

   @LegacySignature(type = Type.VARIABLE, name = "Table")
   public static final object<? extends DataType> table;

   @LegacySignature(type = Type.VARIABLE, name = "TableHandle")
   public static final object<? extends DataType> tableHandle;

   @LegacySignature(type = Type.VARIABLE, name = "UnsignedByte")
   public static final object<? extends DataType> unsignedByte;

   @LegacySignature(type = Type.VARIABLE, name = "UnsignedInt")
   public static final object<? extends DataType> unsignedInt;

   @LegacySignature(type = Type.VARIABLE, name = "UnsignedInt64")
   public static final object<? extends DataType> unsignedInt64;

   @LegacySignature(type = Type.VARIABLE, name = "UnsignedShort")
   public static final object<? extends DataType> unsignedShort;

   @LegacySignature(type = Type.VARIABLE, name = "Void")
   public static final object<? extends DataType> void_;

   static
   {
      registerEnum(DataType.class, DataType::new, "Progress.Reflect.DataType");
      
      anyType = createEnum(DataType.class, "AnyType");
      buffer = createEnum(DataType.class, "Buffer");
      byte_ = createEnum(DataType.class, "Byte");
      character = createEnum(DataType.class, "Character");
      comhandle = createEnum(DataType.class, "COMHandle");
      dataSet = createEnum(DataType.class, "DataSet");
      dataSetHandle = createEnum(DataType.class, "DataSetHandle");
      date = createEnum(DataType.class, "Date");
      dateTime = createEnum(DataType.class, "DateTime");
      dateTimeTz = createEnum(DataType.class, "DateTimeTZ");
      decimal = createEnum(DataType.class, "Decimal");
      double_ = createEnum(DataType.class, "Double");
      float_ = createEnum(DataType.class, "Float");
      handle = createEnum(DataType.class, "Handle");
      int64 = createEnum(DataType.class, "Int64");
      integer = createEnum(DataType.class, "Integer");
      logical = createEnum(DataType.class, "Logical");
      longchar = createEnum(DataType.class, "Longchar");
      memptr = createEnum(DataType.class, "Memptr");
      object_ = createEnum(DataType.class, "Object");
      raw = createEnum(DataType.class, "Raw");
      recid = createEnum(DataType.class, "Recid");
      rowid = createEnum(DataType.class, "Rowid");
      short_ = createEnum(DataType.class, "Short");
      singleCharacter = createEnum(DataType.class, "SingleCharacter");
      table = createEnum(DataType.class, "Table");
      tableHandle = createEnum(DataType.class, "TableHandle");
      unsignedByte = createEnum(DataType.class, "UnsignedByte");
      unsignedInt = createEnum(DataType.class, "UnsignedInt");
      unsignedInt64 = createEnum(DataType.class, "UnsignedInt64");
      unsignedShort = createEnum(DataType.class, "UnsignedShort");
      void_ = createEnum(DataType.class, "Void");
   }

   private DataType(final String name, final Long value)
   {
      super(name, value);
   }

   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "GetEnum", qualified = "Progress.Reflect.DataType", parameters =
   {
      @LegacyParameter(name = "val", type = "INT64", mode = "INPUT")
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   public static object<? extends DataType> getEnum(int64 val)
   {
      return getEnum(DataType.class, val);
   }

   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "GetEnum", qualified = "Progress.Reflect.DataType", parameters =
   {
      @LegacyParameter(name = "val", type = "CHARACTER", mode = "INPUT")
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   public static object<? extends DataType> getEnum(character val)
   {
      return getEnum(DataType.class, val);
   }
}