com.caucho.quercus.program
Class JavaClassDef

java.lang.Object
  extended by com.caucho.quercus.program.ClassDef
      extended by com.caucho.quercus.program.JavaClassDef
Direct Known Subclasses:
CompositeDataClassDef, JavaArrayClassDef, JavaCollectionClassDef, JavaListClassDef, JavaMapClassDef

public class JavaClassDef
extends ClassDef

Represents an introspected Java class.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.caucho.quercus.program.ClassDef
ClassDef.FieldEntry, ClassDef.StaticFieldEntry
 
Field Summary
protected  boolean _isInit
           
 
Constructor Summary
JavaClassDef(ModuleContext moduleContext, java.lang.String name, java.lang.Class type)
           
JavaClassDef(ModuleContext moduleContext, java.lang.String name, java.lang.Class type, java.lang.String extension)
           
 
Method Summary
 void addInterfaces(java.util.HashSet<java.lang.String> interfaceSet)
          Adds the interfaces to the set
protected  void addInterfaces(java.util.HashSet<java.lang.String> interfaceSet, java.lang.Class<?> type, boolean isTop)
           
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value a1)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value[] args)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value a1, Value a2)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value a1, Value a2, Value a3)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value a1, Value a2, Value a3, Value a4)
          Eval a method
 Value callMethod(Env env, Value qThis, StringValue methodName, int hash, Value a1, Value a2, Value a3, Value a4, Value a5)
          Eval a method
 Value callNew(Env env, Value[] args)
          Eval new
 int cmpObject(java.lang.Object lValue, java.lang.Object rValue, JavaClassDef rClassDef)
           
static JavaClassDef create(ModuleContext moduleContext, java.lang.String name, java.lang.Class<?> type)
           
 java.util.Set<? extends java.util.Map.Entry<Value,Value>> entrySet(java.lang.Object obj)
           
 Value findConstant(Env env, java.lang.String name)
          Finds the matching constant
 AbstractFunction findConstructor()
          Returns the constructor
 AbstractFunction findFunction(StringValue methodName)
          Eval a method
 AbstractFunction getCall()
           
 AbstractFunction getCallMethod()
          Returns the __call.
 JavaClassDef getComponentDef()
           
 java.lang.String getExtension()
           
 Value getField(Env env, Value qThis, StringValue name)
          Returns the field getter.
 Marshal getMarshal()
          Returns the marshal instance.
protected  ModuleContext getModuleContext()
           
 java.lang.String getName()
          Returns the class name.
 QuercusClass getQuercusClass()
          Returns the quercus class
 java.lang.String getResourceType()
           
 java.lang.String getSimpleName()
          Returns the class name.
 JavaMethod getToString()
           
 java.lang.Class getType()
           
 void init()
           
 void initClass(QuercusClass cl)
          Initialize the quercus class.
 void initInstance(Env env, Value value)
          Creates a new instance.
 boolean isA(java.lang.String name)
          Returns value for instanceof.
 boolean isAbstract()
          Return true for an abstract class.
 boolean isArray()
           
 boolean isDelegate()
           
 boolean isInterface()
          Return true for an interface class.
 boolean isPhpClass()
           
 boolean jsonEncode(Env env, java.lang.Object obj, StringValue sb)
           
 Value newInstance()
           
 ObjectValue newInstance(Env env, QuercusClass qClass)
          Creates a new instance.
 boolean printRImpl(Env env, java.lang.Object obj, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet)
           
 Value putField(Env env, Value qThis, StringValue name, Value value)
           
 void setPhpClass(boolean isPhpClass)
           
 StringValue toString(Env env, JavaValue value)
           
 boolean varDumpImpl(Env env, Value obj, java.lang.Object javaObj, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet)
           
 Value wrap(Env env, java.lang.Object obj)
           
 
Methods inherited from class com.caucho.quercus.program.ClassDef
addInterface, callNew, createObject, fieldSet, findConstant, functionSet, getComment, getFieldComment, getInterfaces, getLocation, getParentName, getStaticFieldComment, hasNonPublicMethods, init, isFinal, loadClassDef, staticFieldSet, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_isInit

protected volatile boolean _isInit
Constructor Detail

JavaClassDef

public JavaClassDef(ModuleContext moduleContext,
                    java.lang.String name,
                    java.lang.Class type)

JavaClassDef

public JavaClassDef(ModuleContext moduleContext,
                    java.lang.String name,
                    java.lang.Class type,
                    java.lang.String extension)
Method Detail

create

public static JavaClassDef create(ModuleContext moduleContext,
                                  java.lang.String name,
                                  java.lang.Class<?> type)

getName

public java.lang.String getName()
Returns the class name.

Overrides:
getName in class ClassDef

getSimpleName

public java.lang.String getSimpleName()
Returns the class name.


getType

public java.lang.Class getType()

getResourceType

public java.lang.String getResourceType()

getModuleContext

protected ModuleContext getModuleContext()

getExtension

public java.lang.String getExtension()
Overrides:
getExtension in class ClassDef

isA

public boolean isA(java.lang.String name)
Description copied from class: ClassDef
Returns value for instanceof.

Overrides:
isA in class ClassDef

addInterfaces

public void addInterfaces(java.util.HashSet<java.lang.String> interfaceSet)
Adds the interfaces to the set

Overrides:
addInterfaces in class ClassDef

addInterfaces

protected void addInterfaces(java.util.HashSet<java.lang.String> interfaceSet,
                             java.lang.Class<?> type,
                             boolean isTop)

isAbstract

public boolean isAbstract()
Description copied from class: ClassDef
Return true for an abstract class.

Overrides:
isAbstract in class ClassDef

isArray

public boolean isArray()

isInterface

public boolean isInterface()
Description copied from class: ClassDef
Return true for an interface class.

Overrides:
isInterface in class ClassDef

isDelegate

public boolean isDelegate()

setPhpClass

public void setPhpClass(boolean isPhpClass)

isPhpClass

public boolean isPhpClass()

getComponentDef

public JavaClassDef getComponentDef()

wrap

public Value wrap(Env env,
                  java.lang.Object obj)

cmpObject

public int cmpObject(java.lang.Object lValue,
                     java.lang.Object rValue,
                     JavaClassDef rClassDef)

getField

public Value getField(Env env,
                      Value qThis,
                      StringValue name)
Returns the field getter.

Parameters:
name -
Returns:
Value attained through invoking getter

putField

public Value putField(Env env,
                      Value qThis,
                      StringValue name,
                      Value value)

getMarshal

public Marshal getMarshal()
Returns the marshal instance.


newInstance

public ObjectValue newInstance(Env env,
                               QuercusClass qClass)
Creates a new instance.

Overrides:
newInstance in class ClassDef

newInstance

public Value newInstance()

callNew

public Value callNew(Env env,
                     Value[] args)
Eval new

Overrides:
callNew in class ClassDef

getCallMethod

public AbstractFunction getCallMethod()
Returns the __call.


getCall

public AbstractFunction getCall()
Overrides:
getCall in class ClassDef

findFunction

public AbstractFunction findFunction(StringValue methodName)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value[] args)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value a1)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value a1,
                        Value a2)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value a1,
                        Value a2,
                        Value a3)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4)
Eval a method


callMethod

public Value callMethod(Env env,
                        Value qThis,
                        StringValue methodName,
                        int hash,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4,
                        Value a5)
Eval a method


entrySet

public java.util.Set<? extends java.util.Map.Entry<Value,Value>> entrySet(java.lang.Object obj)

initClass

public void initClass(QuercusClass cl)
Initialize the quercus class.

Overrides:
initClass in class ClassDef

findConstant

public Value findConstant(Env env,
                          java.lang.String name)
Finds the matching constant


initInstance

public void initInstance(Env env,
                         Value value)
Creates a new instance.


getQuercusClass

public QuercusClass getQuercusClass()
Returns the quercus class


findConstructor

public AbstractFunction findConstructor()
Returns the constructor

Specified by:
findConstructor in class ClassDef

init

public final void init()
Overrides:
init in class ClassDef

getToString

public JavaMethod getToString()

toString

public StringValue toString(Env env,
                            JavaValue value)

jsonEncode

public boolean jsonEncode(Env env,
                          java.lang.Object obj,
                          StringValue sb)

printRImpl

public boolean printRImpl(Env env,
                          java.lang.Object obj,
                          WriteStream out,
                          int depth,
                          java.util.IdentityHashMap<Value,java.lang.String> valueSet)
                   throws java.io.IOException
Returns:
false if printRImpl not implemented
Throws:
java.io.IOException

varDumpImpl

public boolean varDumpImpl(Env env,
                           Value obj,
                           java.lang.Object javaObj,
                           WriteStream out,
                           int depth,
                           java.util.IdentityHashMap<Value,java.lang.String> valueSet)
                    throws java.io.IOException
Throws:
java.io.IOException