Class PseudoAny

  • All Implemented Interfaces:
    IVilType

    final class PseudoAny
    extends java.lang.Object
    implements IVilType
    A type which can be assigned to any type.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PseudoAny()
      Prevents external instantiation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Boolean convertToBool​(java.lang.Object ob)
      Converts object to boolean if possible.
      static java.lang.Integer convertToInt​(java.lang.Object ob)
      Converts object to int if possible.
      static java.lang.Double convertToReal​(java.lang.Object ob)
      Converts object to real if possible.
      static boolean equals​(java.lang.Object o1, java.lang.Object o2)
      Represents the equality operation for Objects.
      static java.lang.String getLocale​(java.lang.Object ob)
      Returns the current (global) locale.
      static TypeDescriptor<?> getType​(java.lang.Object ob)
      Returns the type of ob.
      static java.lang.String setLocale​(java.lang.Object ob, java.lang.String locale)
      Changes the current (global) locale.
      static boolean unequals​(java.lang.Object o1, java.lang.Object o2)
      Represents the unequality operation for Objects.
      • Methods inherited from class java.lang.Object

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

      • PseudoAny

        private PseudoAny()
        Prevents external instantiation.
    • Method Detail

      • equals

        public static boolean equals​(java.lang.Object o1,
                                     java.lang.Object o2)
        Represents the equality operation for Objects.
        Parameters:
        o1 - the object boolean to be considered
        o2 - the object boolean to be considered
        Returns:
        o1 == o2
      • unequals

        public static boolean unequals​(java.lang.Object o1,
                                       java.lang.Object o2)
        Represents the unequality operation for Objects.
        Parameters:
        o1 - the first object to be considered
        o2 - the second object to be considered
        Returns:
        o1 != o2
      • convertToReal

        public static java.lang.Double convertToReal​(java.lang.Object ob)
        Converts object to real if possible.
        Parameters:
        ob - the object
        Returns:
        the real value or null
      • convertToInt

        public static java.lang.Integer convertToInt​(java.lang.Object ob)
        Converts object to int if possible.
        Parameters:
        ob - the object
        Returns:
        the int value or null
      • convertToBool

        public static java.lang.Boolean convertToBool​(java.lang.Object ob)
        Converts object to boolean if possible.
        Parameters:
        ob - the object
        Returns:
        the boolean value or null
      • getLocale

        public static java.lang.String getLocale​(java.lang.Object ob)
        Returns the current (global) locale.
        Parameters:
        ob - the object to return the current locale for (ignored, needed to assign this to Any)
        Returns:
        the current locale
      • setLocale

        public static java.lang.String setLocale​(java.lang.Object ob,
                                                 java.lang.String locale)
        Changes the current (global) locale.
        Parameters:
        ob - the object to return the current locale for (ignored, needed to assign this to Any)
        locale - the new (global) locale
        Returns:
        the (new) current locale
      • getType

        public static TypeDescriptor<?> getType​(java.lang.Object ob)
        Returns the type of ob. This method is intended as fallback. In particular, basic types, collections and configuration types shall provide their own implementation. The parameter corresponds to the operand to derive the type for, i.e., non-static implementations rely on the implicit object.
        Parameters:
        ob - the object to return the type for
        Returns:
        the type of object (may be TypeRegistry.voidType())