Example #1
0
 public static global::System.Object unboxIfPrimitive(java.lang.Object aValue,
                                                      global::System.Type aType)
 {
     if (!aType.GetTypeInfo().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();
     }
 }
        /**
         * Missing IsSubclassOf, this works well
         */
        public static bool IsSubclassOf(this Type type, global::System.Type parent)
        {
#if NETFX_CORE
            return parent.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo());
#else
            throw new NotImplementedException();
#endif
        }
Example #3
0
 public static java.lang.Object boxIfPrimitive(global::System.Object aValue,
                                               global::System.Type aType)
 {
     if (!aType.GetTypeInfo().IsPrimitive) {
         return (java.lang.Object) aValue; // do nothing
     } else if (aType.Equals(booleanType)) {
         java.lang.Boolean boolBox = new java.lang.Boolean();
         [email protected]((bool) aValue);
         return boolBox;
     } else if (aType.Equals(byteType)) {
         java.lang.Byte byteBox = new java.lang.Byte();
         [email protected]((sbyte) aValue);
         return byteBox;
     } else if (aType.Equals(charType)) {
         java.lang.Character charBox = new java.lang.Character();
         [email protected]((char) aValue);
         return charBox;
     } else if (aType.Equals(shortType)) {
         java.lang.Short shortBox = new java.lang.Short();
         [email protected]((short) aValue);
         return shortBox;
     } else if (aType.Equals(intType)) {
         java.lang.Integer intBox = new java.lang.Integer();
         [email protected]((int) aValue);
         return intBox;
     } else if (aType.Equals(longType)) {
         java.lang.Long longBox = new java.lang.Long();
         [email protected]((long) aValue);
         return longBox;
     } else if (aType.Equals(floatType)) {
         java.lang.Float floatBox = new java.lang.Float();
         [email protected]((float) aValue);
         return floatBox;
     } else if (aType.Equals(doubleType)) {
         java.lang.Double doubleBox = new java.lang.Double();
         [email protected]((double) aValue);
         return doubleBox;
     }  else if (aType.Equals(voidType)) {
         java.lang.Void voidBox = new java.lang.Void();
         [email protected]();
         return voidBox;
     }
     else {
         throw new org.xmlvm._nNativeImplementationException();
     }
 }