Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.9.1)

E67681-01


oracle.jbo
Class AbstractCompileContext

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.lang.Binding
          extended by oracle.jbo.AbstractCompileContext

All Implemented Interfaces:
groovy.lang.GroovyObject, ExprCompileContext
Direct Known Subclasses:
AbstractCompileContext.UntypedExtendedType, DefaultCompileContext, EvaluateExprCompileContextImpl

public abstract class AbstractCompileContext
extends groovy.lang.Binding
implements ExprCompileContext

An abstract implementation of an ExprCompileContext. The abstract context implements a strategy patter for method and variable resolution that is based upon the strategy that is used at script execute time.

Many of the abstract methods defined by this class are designed to return information about the compile context source. This source object usually represents the BC4J owner of the script that is compiling. At execute time it is frequently implemented by an oracle.jbo.Row. At compile time it is exepcted that it will be represented by a BC4J def object or its DT equivalent.

Note that many of the typing methods deal with String types rather than the type classes. This is intentional. Type classes are not available in all compile contexts (DT).

Since:
release specific (what release of product did this appear in)

Nested Class Summary
 class AbstractCompileContext.UntypedExtendedType
           

 

Field Summary
protected  ExprCompileContext mExtendedType
           

 

Fields inherited from interface oracle.jbo.ExprCompileContext
GLOBAL_RECEIVER_NAME, UNKNOWN_PARAMETER_TYPE_NAME, VOID_RETURN_TYPE

 

Constructor Summary
AbstractCompileContext()
           

 

Method Summary
protected  java.lang.Class[] classesFor(java.lang.String[] types)
           
protected  java.lang.Class classFor(java.lang.String type)
           
protected  ExprCompileContext createExtendedType(StructureDefinition structureDefinition)
          Creates a new compile context for the specified structureDefinition.
 ExprCompileContext createUntypedExtendedType(int flags)
           
protected  org.codehaus.groovy.ast.ASTNode getCurrentASTNode()
           
protected  org.codehaus.groovy.ast.MethodNode getCurrentNode()
           
 org.codehaus.groovy.control.ErrorCollector getErrorCollector()
          Returns the error collector that was used during type checking.
abstract  ExprDef getExprDef()
          Return the definition of the expressio that is compiling.
 ExprTrustSupplier getExprTrustSupplier()
          Return the security policiy that is associated with this context.
 ExprCompileContext getExtendedType()
          Return a compile context to type an unhandled variable/property/method that is defined within the context of another variable/property/method.
abstract  java.lang.String getGlobalOperationReturnType(java.lang.String name, java.lang.String... argtypes)
          Return the type of the given global operations.
 java.lang.String getMethodReturnType(java.lang.String receiver, java.lang.String name, java.lang.String[] argtypes, java.lang.String[] argvals)
          Return the return type of the given method.
 java.lang.String getNewValueType()
          In validator contexts this returns the type of the new attribute or row.
 java.lang.String getOldValueType()
          In validator contexts this returns the type of the new attribute or row.
 java.lang.String getPropertyType(java.lang.String objectType, java.lang.String name)
          Return the type of the given property.
protected  java.lang.String getReturnType(java.lang.Class receiver, java.lang.String name, java.lang.Class... argtypes)
           
protected  java.lang.String getReturnType(java.lang.String receiverType, java.lang.String name, java.lang.String... argtypes)
          Get the return type of the specified method on the specified receiver type.
 java.lang.String getSourceAttributeType(java.lang.String name)
          Deprecated. since 11.1.1.7.1. Use the StructureDefinition attributes instead.
 java.lang.String getSourceMethodReturnType(java.lang.String name, java.lang.String... argtypes)
          Deprecated. since 11.1.1.7.1. Use the StructureDefinition operations instead.
 java.lang.String getSourceOperationReturnType(java.lang.String name, java.lang.String... argtypes)
          Deprecated. since 11.1.1.7.1. Use the StructureDefinition operations instead.
 java.lang.String getSourcePropertyType(java.lang.String name)
          Deprecated. since 11.1.1.7.1. Use the StructureDefinition attributes instead.
 java.lang.String getSourceType()
          Deprecated. since 11.1.1.7.1 This should be available as a property of the StructureDefinition. See oracle.adf.model.utils.JSR227Util.ROW_CLASS_NAME.
 StructureDefinition getStructureDefinition()
          Return the oracle.binding.meta.StructureDefnition of the compile context.
 java.lang.String getVariableType(java.lang.String name)
          Return the type of the given variable.
protected  boolean isAssignableFrom(java.lang.Class intrf, java.lang.String type)
          Determines if the specified interface class is assignable from the type.
 boolean isMandatoryAttribute(java.lang.String name)
          Returns whether the specified attribute is mandatory.
 boolean isRowAttribute(java.lang.String name)
          Returns whether the variable resolves to an row attribute.
 boolean isTypeChecked()
          Returns whether type checking should be performed in this compile context.
protected  boolean operationMatches(OperationDefinition operDef, java.lang.String methodName, java.lang.String... params)
           
 void setCurrentASTNode(org.codehaus.groovy.ast.ASTNode node)
           
 void setCurrentNode(org.codehaus.groovy.ast.MethodNode node)
           
 void setErrorCollector(org.codehaus.groovy.control.ErrorCollector errorCollector)
           
 void setTypeCheckerClassLoader(java.lang.ClassLoader classLoader)
           

 

Methods inherited from class groovy.lang.Binding
getProperty, getVariable, getVariables, hasVariable, setProperty, setVariable

 

Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, invokeMethod, setMetaClass

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

mExtendedType

protected ExprCompileContext mExtendedType

Constructor Detail

AbstractCompileContext

public AbstractCompileContext()

Method Detail

getExprDef

public abstract ExprDef getExprDef()
Description copied from interface: ExprCompileContext
Return the definition of the expressio that is compiling.
Specified by:
getExprDef in interface ExprCompileContext

isTypeChecked

public boolean isTypeChecked()
Description copied from interface: ExprCompileContext
Returns whether type checking should be performed in this compile context.
Specified by:
isTypeChecked in interface ExprCompileContext

getSourceType

public java.lang.String getSourceType()
Deprecated. since 11.1.1.7.1 This should be available as a property of the StructureDefinition. See oracle.adf.model.utils.JSR227Util.ROW_CLASS_NAME.
Return the source type of the current compile context.

getStructureDefinition

public StructureDefinition getStructureDefinition()
Description copied from interface: ExprCompileContext
Return the oracle.binding.meta.StructureDefnition of the compile context. For example, when compiling an entity validation rule this should return the StructureDefinition of the entity.
Specified by:
getStructureDefinition in interface ExprCompileContext

getPropertyType

public java.lang.String getPropertyType(java.lang.String objectType,
                                        java.lang.String name)
Description copied from interface: ExprCompileContext
Return the type of the given property.

Invoked by the type checker if it cannot resolve the specifid property.

Specified by:
getPropertyType in interface ExprCompileContext

getVariableType

public java.lang.String getVariableType(java.lang.String name)
Description copied from interface: ExprCompileContext
Return the type of the given variable.

Invoked by the type checker if it cannot resolve the specified variable.

Specified by:
getVariableType in interface ExprCompileContext

isRowAttribute

public boolean isRowAttribute(java.lang.String name)
Description copied from interface: ExprCompileContext
Returns whether the variable resolves to an row attribute.

Invoked by the type checker to perform additional validation of attribute variables.

Specified by:
isRowAttribute in interface ExprCompileContext

isMandatoryAttribute

public boolean isMandatoryAttribute(java.lang.String name)
Description copied from interface: ExprCompileContext
Returns whether the specified attribute is mandatory. The compiler may use this information to perform special checking for the attribute. For example, the compiler will not log warnings for mandatory attribute access that is not null protected.
Specified by:
isMandatoryAttribute in interface ExprCompileContext

getMethodReturnType

public java.lang.String getMethodReturnType(java.lang.String receiver,
                                            java.lang.String name,
                                            java.lang.String[] argtypes,
                                            java.lang.String[] argvals)
Description copied from interface: ExprCompileContext
Return the return type of the given method.

Invoked by the type checker if it cannot resolve the specified method.

Specified by:
getMethodReturnType in interface ExprCompileContext

getGlobalOperationReturnType

public abstract java.lang.String getGlobalOperationReturnType(java.lang.String name,
                                                              java.lang.String... argtypes)
Description copied from interface: ExprCompileContext
Return the type of the given global operations.
Specified by:
getGlobalOperationReturnType in interface ExprCompileContext

getSourceAttributeType

public java.lang.String getSourceAttributeType(java.lang.String name)
Deprecated. since 11.1.1.7.1. Use the StructureDefinition attributes instead.
Return the source attribute type. Many sources like a ViewObject definition may define named attributes. This returns the type of a named attribute.

getSourcePropertyType

public java.lang.String getSourcePropertyType(java.lang.String name)
Deprecated. since 11.1.1.7.1. Use the StructureDefinition attributes instead.
Return the source property type. This is usually a bean property of the source.

getSourceMethodReturnType

public java.lang.String getSourceMethodReturnType(java.lang.String name,
                                                  java.lang.String... argtypes)
Deprecated. since 11.1.1.7.1. Use the StructureDefinition operations instead.
Return the return type of a source method. Many sources may also define custom interfaces (like a row class). This returns the return type of a source's custom interface.

getSourceOperationReturnType

public java.lang.String getSourceOperationReturnType(java.lang.String name,
                                                     java.lang.String... argtypes)
Deprecated. since 11.1.1.7.1. Use the StructureDefinition operations instead.
Return the return type of a source operation. Many sources may declare object functions (operations). The returns the return type of a source's operation.

createExtendedType

protected ExprCompileContext createExtendedType(StructureDefinition structureDefinition)
Creates a new compile context for the specified structureDefinition. The extended type will be stored by the type checker and used to resolve properties or methods of nested AST nodes. For example, assume an emp context and the expression 'dept.deptno'. The compiler will inovke createExtendedType to create an extended type with dept structure for the 'dept' expression. The extended type compile context will be stored and used later to check the deptno property of the 'dept' expression.
Returns:
a compile context. The abstract compile context will return a "default" compile context for the specified structure. A concrete compile context may override this to return a compile context of the concrete type.

getNewValueType

public java.lang.String getNewValueType()
In validator contexts this returns the type of the new attribute or row.

getOldValueType

public java.lang.String getOldValueType()
In validator contexts this returns the type of the new attribute or row.

getExprTrustSupplier

public ExprTrustSupplier getExprTrustSupplier()
Description copied from interface: ExprCompileContext
Return the security policiy that is associated with this context.
Specified by:
getExprTrustSupplier in interface ExprCompileContext

getExtendedType

public ExprCompileContext getExtendedType()
Description copied from interface: ExprCompileContext
Return a compile context to type an unhandled variable/property/method that is defined within the context of another variable/property/method.

This will be invoked once by the type checker after it resolves an unhandled variable/property/method. This method may be used to pass a compile context back to the compile context that will be invoked later to handle types in the enclosing context.

For example, consider an expression that is evaluated in the context of an Emp validator: Dept.Loc

where 'Dept' is defined as an accessor that references the Emp's department.

When the compile context is asked for the java type of the 'Dept' variable (i.e. 'oracle.jbo.Row') an extended type may also be defined by instantiating a new compile context for the 'Dept' structure and returning that when the type checker invokes getExtendedType. The ADF type checking extension will store the extended type with the returned java type. When the 'Loc' property is later typed the type checker will query the 'Dept' variable extended data rather than the base script context.

Specified by:
getExtendedType in interface ExprCompileContext
Returns:
an ExprCompileContext that may be used to further type a variable, property, or method. The extended data should be reset after each call to getExtendedData.

getErrorCollector

public org.codehaus.groovy.control.ErrorCollector getErrorCollector()
Description copied from interface: ExprCompileContext
Returns the error collector that was used during type checking. This is set by the type checker and will not be available until after the type checking phase is complete.

Applications may use the ErrorCollector to get a list of errors/warnings that were discovered during type checking.

Specified by:
getErrorCollector in interface ExprCompileContext

setErrorCollector

public void setErrorCollector(org.codehaus.groovy.control.ErrorCollector errorCollector)
Specified by:
setErrorCollector in interface ExprCompileContext

setTypeCheckerClassLoader

public void setTypeCheckerClassLoader(java.lang.ClassLoader classLoader)
Specified by:
setTypeCheckerClassLoader in interface ExprCompileContext

getReturnType

protected java.lang.String getReturnType(java.lang.String receiverType,
                                         java.lang.String name,
                                         java.lang.String... argtypes)
Get the return type of the specified method on the specified receiver type.

The default implementation uses the groovy MOP to find the method on the receiver class. Concrete implementations may override this method if the receiver class is not available.

Parameters:
receiverType - the type of the Object that will receive the method invocation
name - the name of the method that will be invoked
argtypes - the types of arguments that will be passed

getReturnType

protected java.lang.String getReturnType(java.lang.Class receiver,
                                         java.lang.String name,
                                         java.lang.Class... argtypes)

isAssignableFrom

protected boolean isAssignableFrom(java.lang.Class intrf,
                                   java.lang.String type)
Determines if the specified interface class is assignable from the type.

The assignable rules should be java.lang.Class. The default implementation looks up the Class to determine if it is assignable. Concrete implementations that may not have the type Class available may override this to perform there own checking.

Parameters:
intrf - the interface to check for
type - the type to be checked

classFor

protected java.lang.Class classFor(java.lang.String type)

classesFor

protected java.lang.Class[] classesFor(java.lang.String[] types)

setCurrentNode

public void setCurrentNode(org.codehaus.groovy.ast.MethodNode node)
Specified by:
setCurrentNode in interface ExprCompileContext

getCurrentNode

protected org.codehaus.groovy.ast.MethodNode getCurrentNode()

setCurrentASTNode

public void setCurrentASTNode(org.codehaus.groovy.ast.ASTNode node)
Specified by:
setCurrentASTNode in interface ExprCompileContext

getCurrentASTNode

protected org.codehaus.groovy.ast.ASTNode getCurrentASTNode()

operationMatches

protected boolean operationMatches(OperationDefinition operDef,
                                   java.lang.String methodName,
                                   java.lang.String... params)

createUntypedExtendedType

public ExprCompileContext createUntypedExtendedType(int flags)
For internal use only. Application developers should not use this

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.9.1)

E67681-01


Copyright © 1997, 2016, Oracle. All rights reserved.