示例#1
0
        /**
         * Missing IsSubclassOf, this works well
         */
        public static bool IsSubclassOf(this Type type, global::System.Type parent)
        {
#if NETFX_CORE
            return(!parent.Equals(type) && parent.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()));
#else
            throw new NotImplementedException();
#endif
        }
示例#2
0
 public static global::System.Object unboxIfPrimitive(java.lang.Object aValue,
                                                      global::System.Type aType)
 {
     if (!aType.IsPrimitive)
     {
         return(aValue); // do nothing
     }
     else if (aType.Equals(booleanType))
     {
         return(((java.lang.Boolean)aValue).booleanValue());
     }
     else if (aType.Equals(byteType))
     {
         return(((java.lang.Byte)aValue).byteValue());
     }
     else if (aType.Equals(charType))
     {
         return(((java.lang.Character)aValue).charValue());
     }
     else if (aType.Equals(shortType))
     {
         return(((java.lang.Short)aValue).shortValue());
     }
     else if (aType.Equals(intType))
     {
         return(((java.lang.Integer)aValue).intValue());
     }
     else if (aType.Equals(longType))
     {
         return(((java.lang.Long)aValue).longValue());
     }
     else if (aType.Equals(floatType))
     {
         return(((java.lang.Float)aValue).floatValue());
     }
     else if (aType.Equals(doubleType))
     {
         return(((java.lang.Double)aValue).doubleValue());
     }
     else
     {
         throw new org.xmlvm._nNativeImplementationException();
     }
 }
示例#3
0
        /*
         * public static java.lang.String nativeTypeToJavaTypeName(global::System.Type nativeType) {
         *  string result;
         *  _nTIB tib;
         *  if(!tibTable.TryGetValue(nativeType, out tib)) {
         *      // if it is not already in the table,
         *      //   then the native type name is the same as the java counterpart
         *      result = nativeType.ToString();
         *      tib = new _nTIB(nativeType, result);
         *      tibTable.Add(nativeType, tib);
         *      jNameTable.Add(result, tib);
         *      bootstrapSetClass(tib);
         *  } else {
         *      result = tib.getJavaName();
         *  }
         *  return org.xmlvm._nUtil.toJavaString(result);
         * }
         */

        public static java.lang.Object boxIfPrimitive(global::System.Object aValue,
                                                      global::System.Type aType)
        {
            if (!aType.IsPrimitive)
            {
                return((java.lang.Object)aValue); // do nothing
            }
            else if (aType.Equals(booleanType))
            {
                java.lang.Boolean boolBox = new java.lang.Boolean();
                boolBox.@this((bool)aValue);
                return(boolBox);
            }
            else if (aType.Equals(byteType))
            {
                java.lang.Byte byteBox = new java.lang.Byte();
                byteBox.@this((sbyte)aValue);
                return(byteBox);
            }
            else if (aType.Equals(charType))
            {
                java.lang.Character charBox = new java.lang.Character();
                charBox.@this((char)aValue);
                return(charBox);
            }
            else if (aType.Equals(shortType))
            {
                java.lang.Short shortBox = new java.lang.Short();
                shortBox.@this((short)aValue);
                return(shortBox);
            }
            else if (aType.Equals(intType))
            {
                java.lang.Integer intBox = new java.lang.Integer();
                intBox.@this((int)aValue);
                return(intBox);
            }
            else if (aType.Equals(longType))
            {
                java.lang.Long longBox = new java.lang.Long();
                longBox.@this((long)aValue);
                return(longBox);
            }
            else if (aType.Equals(floatType))
            {
                java.lang.Float floatBox = new java.lang.Float();
                floatBox.@this((float)aValue);
                return(floatBox);
            }
            else if (aType.Equals(doubleType))
            {
                java.lang.Double doubleBox = new java.lang.Double();
                doubleBox.@this((double)aValue);
                return(doubleBox);
            }
            else if (aType.Equals(voidType))
            {
                java.lang.Void voidBox = new java.lang.Void();
                voidBox.@this();
                return(voidBox);
            }
            else
            {
                throw new org.xmlvm._nNativeImplementationException();
            }
        }