示例#1
0
        /**
         * Call the Java constructor and return the wrapped Java object.
         * If constructor @is not available, then return static class definition.
         */
        public static Object java(Env env,
                                  string className,
                                  Value [] args)
        {
            try {
                JavaClassDef def = env.getJavaClassDefinition(className);

                if (def == null)
                {
                    env.warning(L.l("could not find Java class {0}", className));
                    return(null);
                }

                Value newObj = def.callNew(env, args);

                if (newObj.isNull())
                {
                    return(new JavaValue(env, null, def));
                }
                else
                {
                    return(newObj);
                }
            } catch (Exception e) {
                log.log(Level.FINE, e.getMessage(), e);
                env.warning(e);

                return(null);
            }
        }
            synchronized(_javaClassWrappers)
            {
                JavaClassDef def = _javaClassWrappers.get(name);

                if (def == null)
                {
                    if (log.isLoggable(Level.FINEST))
                    {
                        if (extension == null)
                        {
                            log.finest(L.l("PHP loading class {0} with type {1}",
                                           name,
                                           type.getName()));
                        }
                        else
                        {
                            log.finest(L.l(
                                           "PHP loading class {0} with type {1} providing extension {2}",
                                           name,
                                           type.getName(),
                                           extension));
                        }
                    }

                    if (javaClassDefClass != null)
                    {
                        Constructor <?> constructor
                            = javaClassDefClass.getConstructor(ModuleContext.class,
        public Value unmarshal(Env env, Object value)
        {
            // XXX: need test
            string       className = value.getClass().getName();
            JavaClassDef def       = env.getQuercus().getJavaClassDefinition(className);

            return(def.wrap(env, value));
        }
        public JavaMapAdapter(Map map, JavaClassDef def)
        {
            super(map, def);

            _map = map;

            updateNextAvailableIndex();
        }
示例#5
0
 public JavaMarshal(JavaClassDef def,
                    bool isNotNull,
                    bool isUnmarshalNullAsFalse)
 {
     _def       = def;
     _isNotNull = isNotNull;
     _isUnmarshalNullAsFalse = isUnmarshalNullAsFalse;
 }
        /**
         * Creates a function from an introspected java method.
         *
         * @param method the introspected method.
         */
        public JavaMethod(ModuleContext moduleContext,
                          JavaClassDef classDef,
                          Method method)
        {
            super(moduleContext,
                  classDef,
                  method,
                  getName(method),
                  method.getParameterTypes(),
                  method.getParameterAnnotations(),
                  method.getAnnotations(),
                  method.getReturnType());

            _isStatic = Modifier.isStatic(method.getModifiers());
        }
示例#7
0
        /**
         * Returns the static class definition of a Java class.
         */
        public static Object java_class(Env env,
                                        string className)
        {
            try {
                JavaClassDef def = env.getJavaClassDefinition(className);

                if (def == null)
                {
                    env.warning(L.l("could not find Java class {0}", className));
                    return(null);
                }

                return(new JavaValue(env, def.getType(), def));
            } catch (Throwable e) {
                log.log(Level.FINE, e.getMessage(), e);
                env.warning(e);

                return(null);
            }
        }
 public BigDecimalValue(Env env, BigDecimal val, JavaClassDef def)
 {
     super(env, val, def);
     _val = val;
 }
        public JavaMapValue(Env env, Map map, JavaClassDef def)
        {
            super(env, map, def);

            _map = map;
        }
示例#10
0
 public JavaListAdapter(List list, JavaClassDef def)
 {
     super(list, def);
     _list = list;
 }
示例#11
0
 public JavaURLValue(Env env, URL url, JavaClassDef def)
 {
     super(env, url, def);
     _url = url;
 }
 public JavaDateValue(Env env, Date date, JavaClassDef def)
 {
     super(env, date, def);
     _date = date;
 }
 public JavaListMarshal(JavaClassDef def,
                        bool isNotNull,
                        bool isUnmarshalNullAsFalse)
 {
     super(def, isNotNull, isUnmarshalNullAsFalse);
 }
 public JavaListMarshal(JavaClassDef def,
                        bool isNotNull)
 {
     this(def, isNotNull, false);
 }
 public BigIntegerValue(Env env, BigInteger val, JavaClassDef def)
 {
     super(env, val, def);
     _val = val;
 }
示例#16
0
 public JavaCollectionMarshal(JavaClassDef def,
                              bool isNotNull)
 {
     this(def, isNotNull, false);
 }
示例#17
0
 public JavaCalendarValue(Env env, Calendar calendar, JavaClassDef def)
 {
     super(env, calendar, def);
     _calendar = calendar;
 }
        public JavaCollectionAdapter(Collection <Object> coll, JavaClassDef def)
        {
            super(coll, def);

            _collection = coll;
        }