com.caucho.quercus.env
Class QuercusClass

java.lang.Object
  extended by com.caucho.quercus.env.QuercusClass

public class QuercusClass
extends java.lang.Object

Represents a Quercus runtime class.


Constructor Summary
QuercusClass(ClassDef classDef, QuercusClass parent)
           
QuercusClass(ModuleContext moduleContext, ClassDef classDef, QuercusClass parent)
           
QuercusClass(QuercusClass cacheClass, QuercusClass parent)
          Copy based on a cached value
 
Method Summary
 void addConstant(java.lang.String name, Expr expr)
          Adds a constant definition
 void addField(StringValue name, int index, Expr initExpr, FieldVisibility visibility)
          Adds a field.
 int addFieldIndex(StringValue name)
          Adds a field.
 void addInitializer(InstanceInitializer init)
          Adds an initializer
 void addMethod(java.lang.String name, AbstractFunction fun)
          Adds a method.
 void addStaticFieldExpr(java.lang.String className, java.lang.String name, Expr value)
          Adds a static class field.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLength, Expr[] args)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value[] args)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3, Value a4)
          calls the function.
 Value callMethod(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3, Value a4, Value a5)
          calls the function.
 Value callMethod(Env env, Value thisValue, StringValue methodName, Expr[] args)
          calls the function.
 Value callMethod(Env env, Value thisValue, StringValue name, Value[] args)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Expr[] args)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value[] args)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3, Value a4)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, int hash, char[] name, int nameLen, Value a1, Value a2, Value a3, Value a4, Value a5)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, StringValue methodName, Expr[] args)
          calls the function.
 Value callMethodRef(Env env, Value thisValue, StringValue name, Value[] args)
          calls the function.
 Value callNew(Env env, Value[] args)
          Creates a new instance.
 AbstractFunction findConstructor()
          Finds the matching constructor.
 int findFieldIndex(StringValue name)
          Returns the field index.
 AbstractFunction findFunction(java.lang.String name)
          Finds the matching function.
 AbstractFunction findStaticFunction(java.lang.String name)
          Finds the matching function.
 AbstractFunction findStaticFunctionLowerCase(java.lang.String name)
          Finds a function.
 ArrayDelegate getArrayDelegate()
          Gets the array delegate (see ArrayAccess)
 AbstractFunction getCall()
          Gets the __call
 ClassDef getClassDef()
           
 ClassDef[] getClassDefList()
           
 java.lang.Iterable<AbstractFunction> getClassMethods()
          Returns the declared functions.
 java.util.HashMap<StringValue,Expr> getClassVars()
          Returns a set of the fields and their initial values
 Value getConstant(Env env, java.lang.String name)
          Finds the matching constant
 java.util.HashMap<java.lang.String,Expr> getConstantMap()
           
 AbstractFunction getConstructor()
          Gets the constructor.
 CountDelegate getCountDelegate()
          Gets the count delegate
 java.lang.String getExtension()
           
 Value getField(Env env, Value qThis, StringValue name)
          Implements the __get method call.
 AbstractFunction getFieldGet()
          Returns the __fieldGet
 java.util.ArrayList<StringValue> getFieldNames()
          Returns the key set.
 AbstractFunction getFieldSet()
          Returns the __fieldSet
 int getFieldSize()
          Returns the number of fields.
 AbstractFunction getFunction(int hash, char[] name, int nameLen)
          Finds the matching function.
 AbstractFunction getFunction(java.lang.String name)
          Finds the matching function.
 ArrayValue getInterfaces(Env env, boolean autoload)
           
 JavaClassDef getJavaClassDef()
           
 MethodMap<AbstractFunction> getMethodMap()
           
 java.lang.String getName()
          Returns the name.
 QuercusClass getParent()
          Returns the parent class.
 java.lang.String getParentName()
          Returns the parent class.
 Var getStaticField(Env env, java.lang.String name)
           
 java.util.HashMap<java.lang.String,Value> getStaticFieldMap()
           
 AbstractFunction getStaticFunction(java.lang.String name)
          Finds the matching function.
 TraversableDelegate getTraversableDelegate()
          Gets the traversable delegate
 boolean hasConstant(java.lang.String name)
          Returns true if the constant exists.
 boolean implementsInterface(Env env, java.lang.String name)
           
 void init(Env env)
           
 boolean isA(java.lang.String name)
          Returns true for an implementation of a class
 boolean isAbstract()
           
 boolean isFinal()
           
 boolean isInterface()
           
 void setArrayDelegate(ArrayDelegate delegate)
          Sets the array delegate (see ArrayAccess)
 void setCall(AbstractFunction fun)
          Sets the __call
 void setConstructor(AbstractFunction fun)
          Sets the constructor.
 void setCountDelegate(CountDelegate delegate)
          Sets the count delegate
 void setField(Env env, Value qThis, StringValue name, Value value)
          Implements the __set method call.
 void setFieldGet(AbstractFunction fun)
          Sets the __fieldGet
 void setFieldSet(AbstractFunction fun)
          Sets the __fieldSet
 void setTraversableDelegate(TraversableDelegate delegate)
          Sets the traversable delegate
 java.lang.String toString()
           
 void validate(Env env)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuercusClass

public QuercusClass(ClassDef classDef,
                    QuercusClass parent)

QuercusClass

public QuercusClass(ModuleContext moduleContext,
                    ClassDef classDef,
                    QuercusClass parent)

QuercusClass

public QuercusClass(QuercusClass cacheClass,
                    QuercusClass parent)
Copy based on a cached value

Method Detail

getClassDef

public ClassDef getClassDef()

getJavaClassDef

public JavaClassDef getJavaClassDef()

getMethodMap

public MethodMap<AbstractFunction> getMethodMap()

getName

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


getParent

public QuercusClass getParent()
Returns the parent class.


getClassDefList

public ClassDef[] getClassDefList()

getExtension

public java.lang.String getExtension()

isInterface

public boolean isInterface()

isAbstract

public boolean isAbstract()

isFinal

public boolean isFinal()

setConstructor

public void setConstructor(AbstractFunction fun)
Sets the constructor.


getConstructor

public AbstractFunction getConstructor()
Gets the constructor.


setArrayDelegate

public void setArrayDelegate(ArrayDelegate delegate)
Sets the array delegate (see ArrayAccess)


getArrayDelegate

public final ArrayDelegate getArrayDelegate()
Gets the array delegate (see ArrayAccess)


setTraversableDelegate

public void setTraversableDelegate(TraversableDelegate delegate)
Sets the traversable delegate


getTraversableDelegate

public final TraversableDelegate getTraversableDelegate()
Gets the traversable delegate


setCountDelegate

public void setCountDelegate(CountDelegate delegate)
Sets the count delegate


getCountDelegate

public final CountDelegate getCountDelegate()
Gets the count delegate


setFieldGet

public void setFieldGet(AbstractFunction fun)
Sets the __fieldGet


getFieldGet

public AbstractFunction getFieldGet()
Returns the __fieldGet


setFieldSet

public void setFieldSet(AbstractFunction fun)
Sets the __fieldSet


getFieldSet

public AbstractFunction getFieldSet()
Returns the __fieldSet


setCall

public void setCall(AbstractFunction fun)
Sets the __call


getCall

public AbstractFunction getCall()
Gets the __call


addInitializer

public void addInitializer(InstanceInitializer init)
Adds an initializer


addField

public void addField(StringValue name,
                     int index,
                     Expr initExpr,
                     FieldVisibility visibility)
Adds a field.


addFieldIndex

public int addFieldIndex(StringValue name)
Adds a field.


getClassVars

public java.util.HashMap<StringValue,Expr> getClassVars()
Returns a set of the fields and their initial values


getClassMethods

public java.lang.Iterable<AbstractFunction> getClassMethods()
Returns the declared functions.


addMethod

public void addMethod(java.lang.String name,
                      AbstractFunction fun)
Adds a method.


addStaticFieldExpr

public void addStaticFieldExpr(java.lang.String className,
                               java.lang.String name,
                               Expr value)
Adds a static class field.


addConstant

public void addConstant(java.lang.String name,
                        Expr expr)
Adds a constant definition


getFieldSize

public int getFieldSize()
Returns the number of fields.


findFieldIndex

public int findFieldIndex(StringValue name)
Returns the field index.


getFieldNames

public java.util.ArrayList<StringValue> getFieldNames()
Returns the key set.


validate

public void validate(Env env)

init

public void init(Env env)

getStaticField

public Var getStaticField(Env env,
                          java.lang.String name)

getStaticFieldMap

public java.util.HashMap<java.lang.String,Value> getStaticFieldMap()

callNew

public Value callNew(Env env,
                     Value[] args)
Creates a new instance.


getParentName

public java.lang.String getParentName()
Returns the parent class.


isA

public boolean isA(java.lang.String name)
Returns true for an implementation of a class


getInterfaces

public ArrayValue getInterfaces(Env env,
                                boolean autoload)

implementsInterface

public boolean implementsInterface(Env env,
                                   java.lang.String name)

findConstructor

public AbstractFunction findConstructor()
Finds the matching constructor.


getField

public Value getField(Env env,
                      Value qThis,
                      StringValue name)
Implements the __get method call.


setField

public void setField(Env env,
                     Value qThis,
                     StringValue name,
                     Value value)
Implements the __set method call.


findFunction

public AbstractFunction findFunction(java.lang.String name)
Finds the matching function.


findStaticFunction

public AbstractFunction findStaticFunction(java.lang.String name)
Finds the matching function.


getFunction

public final AbstractFunction getFunction(java.lang.String name)
Finds the matching function.


getFunction

public final AbstractFunction getFunction(int hash,
                                          char[] name,
                                          int nameLen)
Finds the matching function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLength,
                        Expr[] args)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        StringValue methodName,
                        Expr[] args)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value[] args)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        StringValue name,
                        Value[] args)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value a1)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value a1,
                        Value a2)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value a1,
                        Value a2,
                        Value a3)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4)
calls the function.


callMethod

public Value callMethod(Env env,
                        Value thisValue,
                        int hash,
                        char[] name,
                        int nameLen,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4,
                        Value a5)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Expr[] args)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           StringValue methodName,
                           Expr[] args)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value[] args)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           StringValue name,
                           Value[] args)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value a1)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value a1,
                           Value a2)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value a1,
                           Value a2,
                           Value a3)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value a1,
                           Value a2,
                           Value a3,
                           Value a4)
calls the function.


callMethodRef

public Value callMethodRef(Env env,
                           Value thisValue,
                           int hash,
                           char[] name,
                           int nameLen,
                           Value a1,
                           Value a2,
                           Value a3,
                           Value a4,
                           Value a5)
calls the function.


findStaticFunctionLowerCase

public AbstractFunction findStaticFunctionLowerCase(java.lang.String name)
Finds a function.


getStaticFunction

public final AbstractFunction getStaticFunction(java.lang.String name)
Finds the matching function.


getConstant

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


hasConstant

public final boolean hasConstant(java.lang.String name)
Returns true if the constant exists.


getConstantMap

public final java.util.HashMap<java.lang.String,Expr> getConstantMap()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object