psdi.util

Class MaxType

  • java.lang.Object
    • psdi.util.MaxType
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    MaxTypeALN, MaxTypeDATE, MaxTypeFLOAT, MaxTypeINTEGER, MaxTypeYORN


    public abstract class MaxType
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Object that represents all the basic types availabe in MAXIMO. This is used, as the programmer may not be totally sure what type a field is until runtime.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int ALN
      Alpha-numeric
      static int AMOUNT
      Currency
      static int BIGINT
      Big integer
      static int BLOB
      Binary large object (BLOB).
      static int CLOB
      Character long object (CLOB).
      static int CRYPTO
      Encrypted raw (CRYPTO).
      static int CRYPTOX
      Encrypted raw, undecryptable (CRYPTOX).
      static int DATE
      Date
      static int DATETIME
      Date amd Time
      static int DECIMAL
      Fixed decimal point
      static int DEFAULMAXLENGTH
      Default maxlength if not specified during construction of the datatype.
      static int DEFAULTSCALE
      Default scale for decimal and amount data type.
      static int DURATION
      Duration type
      static int FLOAT
      Floating point value
      static int GL
      GL Type
      static int INTEGER
      Integer value
      static int LONGALN
      Long String (ALN).
      static int LOWER
      Lower case only
      static int SMALLINT
      Small Integer value
      static int TIME
      Time only
      static int UDTYPE
      User defined types start at this number
      static int UPPER
      Upper case only
      static int YORN
      Boolean (Yes or No)
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected MaxType() 
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean asBoolean()
      Return as boolean Throws Exception if value is null or cannot be returned as this type.
      byte[] asBytes()
      Return as byte array.
      java.util.Date asDate()
      Return as a Date object Returns null if value is null.
      double asDouble()
      Return as double.
      float asFloat()
      Return the value as a float
      int asInt()
      Return as an int.
      abstract java.lang.String asLocaleString()
      Return as a locale sensitive string using the default timeZone and locale Returns "" if value is null.
      abstract java.lang.String asLocaleString(java.util.Locale l)
      Return as a locale sensitive string using the default TimeZone and the specified Locale Returns "" if value is null.
      abstract java.lang.String asLocaleString(java.util.Locale l, java.util.TimeZone tz)
      Return as a locale sensitive string using the specified TimeZone and Locale Returns "" if value is null.
      long asLong()
      Return as a long.
      abstract java.lang.String asString()
      Return as a string.
      abstract java.lang.Object clone() 
      static MaxType createMaxType(java.util.Locale l, java.util.TimeZone tz, int type)
      Instantiate a MaxType object based on the type, locale and timezone.
      static MaxType createMaxType(java.util.Locale l, java.util.TimeZone tz, int type, int length, int scale)
      Instantiate a MaxType object based on the locale, timezone, type, length and scale.
      java.lang.String getAttributeName() 
      int getMaxLength()
      Return maximum length.
      java.lang.String getObjectName() 
      int getScale()
      Return the scale used by decimal and amount types.
      abstract int getType()
      Get the current type
      boolean isNull()
      Is the current value null ??
      void overrideStringData(java.lang.String newValue)
      This should be called only in very special circumstances related to conversion of a value between locales (for example, maxattributecfg.defaultvalue).
      void setAftercheckLengthAndScale(java.lang.String val)
      Check length and scale agaist the current length and scale and then set the value if it is alright.
      void setAttributeName(java.lang.String attributeName) 
      void setMaxLength(int l)
      Set maximum length.
      void setObjectName(java.lang.String objectName) 
      void setScale(int s)
      Set the scale for DECIMAL and AMOUNT MaxType.
      void setValue(boolean value)
      Set the value to the specified value.
      void setValue(byte[] value)
      Set the value to the specified value.
      void setValue(java.util.Date value)
      Set the value to the specified value.
      void setValue(double value)
      Set the value to the specified value.
      void setValue(float value)
      Set the value to the specified value.
      void setValue(int value)
      Set the value to the specified value.
      void setValue(long value)
      Set the value to the specified value.
      abstract void setValue(MaxType value) 
      abstract void setValue(java.lang.String value)
      Set the value to the specified value.
      void setValueNull()
      Set the current value to be null
      java.lang.String toString()
      Override object.toString() to give some debug info.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MaxType

        protected MaxType()
    • Method Detail

      • setMaxLength

        public void setMaxLength(int l)
        Set maximum length. It is not applicable for some datatypes. But for backward compatability the method does nothing for those data types. value.
      • getMaxLength

        public int getMaxLength()
        Return maximum length. Default will be returned if not applicable to the data type. The method is in place for non-applicable data types for backward compatibility reason.
      • getScale

        public int getScale()
        Return the scale used by decimal and amount types. Otherwise 0 will be returned.
      • setScale

        public void setScale(int s)
                      throws MXException
        Set the scale for DECIMAL and AMOUNT MaxType. The method is only valid for DECIMAL and AMOUNT datatype. The scale is ignored for other data types.
        Throws:
        MXException
      • setValue

        public abstract void setValue(java.lang.String value)
                               throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(java.util.Date value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(byte[] value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(double value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(float value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(int value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(long value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • setValue

        public void setValue(boolean value)
                      throws MXException
        Set the value to the specified value. Throws Exception if cannot be converted to current type.
        Throws:
        MXException
      • asString

        public abstract java.lang.String asString()
        Return as a string. Returns "" if value is null.
      • asLocaleString

        public abstract java.lang.String asLocaleString(java.util.Locale l)
        Return as a locale sensitive string using the default TimeZone and the specified Locale Returns "" if value is null.
      • asLocaleString

        public abstract java.lang.String asLocaleString(java.util.Locale l,
                                                        java.util.TimeZone tz)
        Return as a locale sensitive string using the specified TimeZone and Locale Returns "" if value is null.
      • asLocaleString

        public abstract java.lang.String asLocaleString()
        Return as a locale sensitive string using the default timeZone and locale Returns "" if value is null.
      • asDate

        public java.util.Date asDate()
                              throws MXException
        Return as a Date object Returns null if value is null. Throws Exception if cannot be returned as this type.
        Throws:
        MXException
      • asDouble

        public double asDouble()
                        throws MXException
        Return as double. Throws Exception if value is null or cannot be returned as this type.
        Throws:
        MXException
      • asInt

        public int asInt()
                  throws MXException
        Return as an int. Throws Exception if value is null or cannot be returned as this type.
        Throws:
        MXException
      • asLong

        public long asLong()
                    throws MXException
        Return as a long. Throws Exception if value is null or cannot be returned as this type.
        Throws:
        MXException
      • asBoolean

        public boolean asBoolean()
                          throws MXException
        Return as boolean Throws Exception if value is null or cannot be returned as this type.
        Throws:
        MXException
      • asBytes

        public byte[] asBytes()
                       throws MXException
        Return as byte array. Throws Exception if value cannot be returned as this type.
        Throws:
        MXException
      • isNull

        public boolean isNull()
        Is the current value null ??
      • setValueNull

        public void setValueNull()
        Set the current value to be null
      • getType

        public abstract int getType()
        Get the current type
      • toString

        public java.lang.String toString()
        Override object.toString() to give some debug info.
        Overrides:
        toString in class java.lang.Object
      • clone

        public abstract java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • setAftercheckLengthAndScale

        public void setAftercheckLengthAndScale(java.lang.String val)
                                         throws MXException
        Check length and scale agaist the current length and scale and then set the value if it is alright. The number after decimal point will be trimed by the scale.
        Parameters:
        value -
        Throws:
        MXException
      • overrideStringData

        public void overrideStringData(java.lang.String newValue)
        This should be called only in very special circumstances related to conversion of a value between locales (for example, maxattributecfg.defaultvalue).
        Parameters:
        newValue -
      • createMaxType

        public static MaxType createMaxType(java.util.Locale l,
                                            java.util.TimeZone tz,
                                            int type)
                                     throws MXException
        Instantiate a MaxType object based on the type, locale and timezone. If maximum length and scale are applicable to the data type, the length check will be disabled and the default scale is 2.
        Parameters:
        l - locale, null if not applicable.
        tz - timezone, null if not applicable
        type -
        Returns:
        Throws:
        MXException
      • createMaxType

        public static MaxType createMaxType(java.util.Locale l,
                                            java.util.TimeZone tz,
                                            int type,
                                            int length,
                                            int scale)
                                     throws MXException
        Instantiate a MaxType object based on the locale, timezone, type, length and scale.
        Parameters:
        l - locale, null if not applicable.
        tz - timezone, null if not applicable
        type - The datatype
        length - max length, use MaxType.DEFAULTMAXLENGTH as default or if not applicable to the data type
        scale - scale, use MaxTupe.DEFAULTSCALE is not applicable to the datatype
        Returns:
        Throws:
        MXException
      • getObjectName

        public java.lang.String getObjectName()
      • setObjectName

        public void setObjectName(java.lang.String objectName)
      • getAttributeName

        public java.lang.String getAttributeName()
      • setAttributeName

        public void setAttributeName(java.lang.String attributeName)