Class AbstractMethodDefinition

    • Field Detail

      • name

        public java.lang.String name
      • arrayDimensions

        public java.lang.String arrayDimensions
      • throwsTypes

        public java.util.List<JavaType> throwsTypes
      • typeParameters

        public java.util.List<TypeParameter> typeParameters
      • modified

        public transient boolean modified
        True when this method modifies another method: TODO: rename this to "modifyingMethod"? It's hard to tell which side it reflects now
      • needsDynInvoke

        public transient boolean needsDynInvoke
      • overriddenMethodName

        public transient java.lang.String overriddenMethodName
        When this method overrides a method in a downstream layer, the generated name of the method this method has modified so we can remap super calls to this method (_super_x())
      • overriddenLayer

        public transient java.lang.String overriddenLayer
      • parameterTypes

        public transient java.lang.Object[] parameterTypes
      • replacedByMethod

        public transient AbstractMethodDefinition replacedByMethod
        A method to be used in place of the previous method - either because it was modified (replaced=false) or a type was reloaded (replaced=true)
      • replaced

        public transient boolean replaced
        Goes along with replacedByMethod when that is used to indicate a method which actually replaces this instance in this layer

        public static final java.lang.String METHOD_TYPE_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractMethodDefinition

        public AbstractMethodDefinition()
    • Method Detail

      • execForRuntime

        public Statement.RuntimeStatus execForRuntime​(LayeredSystem runtimeSys)
        Description copied from class: Statement
        When choosing in which runtimes to run this statement, returns the member or type of the method or field used in the expression. Not always possible to determine so return null in those other cases.
        execForRuntime in class Statement
      • definesMethod

        public java.lang.Object definesMethod​(java.lang.String methodName,
                                              java.util.List<?> methParams,
                                              ITypeParamContext ctx,
                                              java.lang.Object refType,
                                              boolean isTransformed,
                                              boolean staticOnly,
                                              java.lang.Object inferredType,
                                              java.util.List<JavaType> methodTypeArgs)
        definesMethod in class JavaSemanticNode
      • parametersMatch

        public java.lang.Object parametersMatch​(java.util.List<? extends java.lang.Object> otherParams,
                                                ITypeParamContext ctx,
                                                java.lang.Object inferredType,
                                                java.util.List<JavaType> methodTypeArgs)
      • getParameterList

        public java.util.List<Parameter> getParameterList()
      • initBody

        public void initBody()
      • addStatementsAt

        public void addStatementsAt​(int position,
                                    java.util.List<Statement> statements)
      • addStatementAt

        public void addStatementAt​(int position,
                                   Statement statement)
      • addStatement

        public void addStatement​(Statement statement)
      • addStatementIndent

        public void addStatementIndent​(Statement statement)
      • isDynMethod

        public boolean isDynMethod()
      • invoke

        public java.lang.Object invoke​(ExecutionContext ctx,
                                       java.util.List<java.lang.Object> paramValues)
      • callVirtual

        public java.lang.Object callVirtual​(java.lang.Object thisObj,
                                            java.lang.Object... values)
        Calls this method externally with the given this
      • call

        public java.lang.Object call​(java.lang.Object thisObj,
                                     java.lang.Object... values)
        Calls this method externally with the given this
      • callStatic

        public java.lang.Object callStatic​(java.lang.Object thisType,
                                           java.lang.Object... values)
      • useDefaultModifier

        public boolean useDefaultModifier()
        Turn this on unless we are in an interface or annotation type
        useDefaultModifier in class Definition
      • getParameterString

        public java.lang.String getParameterString()
        Description copied from interface: IMethodDefinition
        Descriptive view of the parameters with parens - i.e. () for no params or (int foo)
        Specified by:
        getParameterString in interface IMethodDefinition
      • getRuntimeMethod

        public java.lang.Object getRuntimeMethod()
      • addBodyStatementAt

        public void addBodyStatementAt​(int i,
                                       Statement superSt)
      • setExceptionTypes

        public void setExceptionTypes​(java.lang.Object[] types)
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • callsSuper

        public boolean callsSuper​(boolean checkModSuper)
        Description copied from class: Statement
        Does this method call "super(xxx)" for a constructor definition
        callsSuper in class Statement
      • callsSuperMethod

        public boolean callsSuperMethod​(java.lang.String methName)
        Description copied from class: Statement
        Does this method call super.methName()
        callsSuperMethod in class Statement
      • transformTemplate

        public int transformTemplate​(int ix,
                                     boolean statefulContext)
        Description copied from class: JavaSemanticNode
        A pass over the semantic node tree to convert template statements into layer cake statements.
        transformTemplate in class TypedDefinition
      • getNeedsDynInvoke

        public boolean getNeedsDynInvoke()
      • deepCopy

        public AbstractMethodDefinition deepCopy​(int options,
                                                 java.util.IdentityHashMap<java.lang.Object,​java.lang.Object> oldNewMap)
        Description copied from interface: ISemanticNode
        Performs a deep copy of the semantic node tree. Subclasses should do their own copy implementation to decide what else to copy. Uses the copy options flags above. The default, with 0, just copies the semantic node information so you get a new tree like's it parsed but without parse node info. Use that mode only if you want to throw away the original source and regenerate it all from scratch. Otherwise, you can copy the parse tree as well. If you want to copy the semantic node's initial resolved state - including it's init/start, etc. and whatever the subclass adds to that copy, use CopyState or CopyNormal - for both parse nodes and state.
        Specified by:
        deepCopy in interface ISemanticNode
        deepCopy in class Statement
      • setNodeName

        public void setNodeName​(java.lang.String newName)
        Specified by:
        setNodeName in interface INamedNode
      • getNodeName

        public java.lang.String getNodeName()
        Specified by:
        getNodeName in interface INamedNode
      • refreshNode

        public AbstractMethodDefinition refreshNode()
        Description copied from class: JavaSemanticNode
        Needs to be implemented for IDE support on nodes which can be referenced outside of the same file. If the model in which this references lives has been removed (or really replaced by another version of the same model), we need to find the node in the other model that corresponds to this node and return it.
        Specified by:
        refreshNode in interface ISemanticNode
        refreshNode in class JavaSemanticNode
      • addBreakpointNodes

        public void addBreakpointNodes​(java.util.List<ISrcStatement> res,
                                       ISrcStatement toFind)
        Description copied from interface: ISrcStatement
        Adds all of the generated statements to the resulting list, for the case where more than one fromStatement points to the same src statement. These are used to determine which statements in the generated code should cause a 'break' when the developer sets a breakpoint on this statement.
        Specified by:
        addBreakpointNodes in interface ISrcStatement
        addBreakpointNodes in class Statement
      • updateFromStatementRef

        public boolean updateFromStatementRef​(Statement fromSt,
                                              ISrcStatement defaultSt)
        Description copied from class: Statement
        During code-transformation, sometimes we end up parsing dynamically generated code which is derived from some source objects - e.g. during the object and property transformation. This method registers the generated code. You can provide a 'fromStatement' and a default statement. If the from statement matches, this node is updated. If the fromStatement is null the defaultStatement is used.

        To determine whether the fromStatement matches this statement, we call matchesStatement. For assignment expressions right now, that allows us to match the right assignment statement in the list to the source from which it was generated from.

        updateFromStatementRef in class Statement
      • needsEnclosingClass

        public boolean needsEnclosingClass()
        Description copied from class: Statement
        Disables the optimization where 'object foo extends bar' omits class foo for simple configuration objects. Certain constructs like methods, fields, clearly disable this. Others like EnclosingType.this also will because we can only evaluate that expression in the context of a class (unless I suppose the object happens to be a child of the same outer type)
        needsEnclosingClass in class Statement
      • getInnerTypeName

        public java.lang.String getInnerTypeName()
      • addRemoteRuntime

        public void addRemoteRuntime​(java.lang.String remoteRuntimeName)
      • getMethodFullName

        public java.lang.String getMethodFullName()
      • addToFileLineIndex

        public void addToFileLineIndex​(GenFileLineIndex idx,
                                       int rootStartGenLine)
        Use the default implementation to register the method declaration line. After that, we add one for the final close brace - where Java stops before exiting the method.
        addToFileLineIndex in class Statement
      • getMethodTypeName

        public java.lang.String getMethodTypeName()
      • setMethodTypeName

        public void setMethodTypeName​(java.lang.String mtn)
      • getObjectId

        public java.lang.String getObjectId()
        Specified by:
        getObjectId in interface IObjectId