Package com.caucho.quercus.program

Examples of com.caucho.quercus.program.JavaClassDef$JavaEntry


      if (importPhpClass(name)) {
        return findClass(name, false, false);
      }
      else {
        try {
          JavaClassDef javaClassDef = getJavaClassDefinition(name, true);

          if (javaClassDef != null) {
            QuercusClass cls = createQuercusClass(id, javaClassDef, null);

            _qClass[id] = cls;
View Full Code Here


      marshal = new JavaArrayMarshal(argType);
    }
    else if (Map.class.isAssignableFrom(argType)) {
      String typeName = argType.getName();

      JavaClassDef javaDef = _moduleContext.getJavaClassDefinition(typeName);

      marshal = new JavaMapMarshal(javaDef, isNotNull, isNullAsFalse);
    }
    else if (List.class.isAssignableFrom(argType)) {
      String typeName = argType.getName();

      JavaClassDef javaDef = _moduleContext.getJavaClassDefinition(typeName);

      marshal = new JavaListMarshal(javaDef, isNotNull, isNullAsFalse);
    }
    else if (Collection.class.isAssignableFrom(argType)) {
      String typeName = argType.getName();

      JavaClassDef javaDef = _moduleContext.getJavaClassDefinition(typeName);

      marshal = new JavaCollectionMarshal(javaDef, isNotNull, isNullAsFalse);
    }
    else if (Enum.class.isAssignableFrom(argType)) {
      marshal = new EnumMarshal(argType);
    }
    else {
      String typeName = argType.getName();

      JavaClassDef javaDef = _moduleContext.getJavaClassDefinition(typeName);

      marshal = new JavaMarshal(javaDef, isNotNull, isNullAsFalse);
    }

    if (!isNullAsFalse)
View Full Code Here

  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;
View Full Code Here

   */
  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;
View Full Code Here

           InvocationTargetException,
           IllegalAccessException,
           InstantiationException
  {
    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,
                                             String.class,
                                             Class.class);

        def = (JavaClassDef) constructor.newInstance(this, name, type);
      }
      else {
        def = JavaClassDef.create(this, name, type);

        if (def == null)
          def = createDefaultJavaClassDef(name, type, extension);
      }
     
      def.setPhpClass(true);

      _javaClassWrappers.put(name, def);
      // _lowerJavaClassWrappers.put(name.toLowerCase(), def);

      _staticClasses.put(name, def);
View Full Code Here

  /**
   * Gets or creates a JavaClassDef for the given class name.
   */
  public JavaClassDef getJavaClassDefinition(Class type, String className)
  {
    JavaClassDef def;
   
    synchronized (_javaClassWrappers) {
      def = _javaClassWrappers.get(className);

      if (def != null)
View Full Code Here

    // Note, this method must not trigger an introspection to avoid
    // any race conditions.  It is only responsible for creating the
    // wrapper around the class, i.e. it's a leaf node, not a recursive not

    synchronized (_javaClassWrappers) {
      JavaClassDef def = _javaClassWrappers.get(className);

      if (def != null)
        return def;

      try {
View Full Code Here

                                                   Class type)
  {
    if (type.isArray())
      return new JavaArrayClassDef(this, className, type);
    else
      return new JavaClassDef(this, className, type);
  }
View Full Code Here

                                                   String extension)
  {
    if (type.isArray())
      return new JavaArrayClassDef(this, className, type, extension);
    else
      return new JavaClassDef(this, className, type, extension);
  }
View Full Code Here

  public void introspectJavaClass(String name, Class type, String extension,
                                  Class javaClassDefClass)
    throws IllegalAccessException, InstantiationException, ConfigException,
           NoSuchMethodException, InvocationTargetException
  {
    JavaClassDef def = addClass(name, type, extension, javaClassDefClass);

    synchronized (_javaClassWrappers) {
      _javaClassWrappers.put(name, def);
      _javaClassWrappers.put(type.getName(), def);
      // _lowerJavaClassWrappers.put(name.toLowerCase(), def);
View Full Code Here

TOP

Related Classes of com.caucho.quercus.program.JavaClassDef$JavaEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.