Class SMethodImpl<T>
- java.lang.Object
 - 
- jetbrains.mps.core.aspects.behaviour.SMethodImpl<T>
 
 
- 
- All Implemented Interfaces:
 SExecutable,SMethod<T>,SElement,SNamedElement
public final class SMethodImpl<T> extends Object implements SMethod<T>
As for 3.2 -- we still have the behavior language which allows several methods with identical signature. Moreover it urges us to point to the overridden method explicitly. Pro & contra 1. The good part is a possibility to resolve a simple case: abstract I1#foo(); abstract I2#foo(); concept C extends I1, I2. We are able to deliver up two separate methods (with the same java signature) overriding each foo separately. 2. The bad part is that a user of the system can easily make a mess: methods are resolved by id. Also the generated code is forced to make the most of id, because string name resolving is simply not enough here. Besides it is not that easy to override method -- one needs to reference the method he wants to override. Plan for 3.3: 1. Make the 'overrides' reference optional: simply rename all the methods so that overridden_method.name.equals(this.name) 'overrides' is required only two virtual method hierarchies clash in the concept. 2. Grant the 'virtual' keyword new semantics: automatic method resolve must happen in the case of virtual methods with overridden method == null. 3. Give out an error about methods' name collision, forbid generation if that is the case. Only there is no conflict for virtual methods' names throughout in the concept hierarchy it might be possible to resolve two overriding methods by name. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringMETHOD_NAME_ID_SEPARATOR 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> SMethod<T>create(String methodName, SModifiers modifiers, SAbstractType returnType, SAbstractConcept concept, SMethodId id, BehaviorRegistry registry, List<SParameter> parameters)NB: there is a cozySMethodBuilderto create SMethodbooleanequals(Object o)SAbstractConceptgetConcept()SExecutable must belong to some concept For example in the case of SMethod the concept is the concept where the method is declaredList<SThrowable>getExceptions()SMethodIdgetId()SModifiersgetModifiers()StringgetName()Presentation of the element for an end-user.List<SParameter>getParameters()SAbstractTypegetReturnType()inthashCode()Tinvoke(SAbstractConcept operand, Object... parameters)invokes the method in the case it is static (trying to resolve the right method on runtime if it is virtual)Tinvoke(SNode operand, Object... parameters)invokes the method (trying to resolve the right method on runtime if it is virtual) essentially invokes the #invoke0 method with the concept of the operandTinvoke0(SAbstractConcept operand, SAbstractConcept concreteConcept, Object... parameters)Tinvoke0(SNode operand, SAbstractConcept concreteConcept, Object... parameters)invokes the virtual method as if applied to the node of the concreteConceptTinvokeSpecial(SAbstractConcept operand, Object... parameters)invokes private method (no dynamic method resolve)TinvokeSpecial(SNode operand, Object... parameters)invokes private method (no dynamic method resolve) generated from the super non-virtual invocations or the super<> invocations TinvokeSuper(SAbstractConcept operand, SAbstractConcept concept, Object... parameters)invokes virtual method looking for the ancestors of the concept (dynamic method resolve)TinvokeSuper(SNode operand, SAbstractConcept concept, Object... parameters)invokes virtual method looking for the ancestors of the node's concept (dynamic method resolve)booleanisAbstract()abstract => virtualbooleanisPublic()booleanisStatic()booleanisVirtual()StringtoString()- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface org.jetbrains.mps.openapi.language.SElement
getLanguage, getSourceNode 
 - 
 
 - 
 
- 
- 
Field Detail
- 
METHOD_NAME_ID_SEPARATOR
public static final String METHOD_NAME_ID_SEPARATOR
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
create
public static <T> SMethod<T> create(@NotNull String methodName, @NotNull SModifiers modifiers, @NotNull SAbstractType returnType, @NotNull SAbstractConcept concept, @NotNull SMethodId id, @NotNull BehaviorRegistry registry, List<SParameter> parameters)
NB: there is a cozySMethodBuilderto create SMethod- Type Parameters:
 T- -- parametrized by return type- Parameters:
 methodName- -- usual methodNamemodifiers- -- could be virtual or (and) static. @see SMethodModifiersreturnType- -- return typeconcept- -- the concept, which contains the method declaration. we need it to distinguish two identically named non-virtual methods in the parent and the child classes.parameters- -- the types of method's argumentsid- -- method string id which must uniquely identify the method throughout the concept hierarchy. NB: for the virtual methods which have the same base method, the id must be the same.registry- -- BehaviorRegistry to get the mapping concept <-> behavior descriptor- Returns:
 - new SMethod
 
 
- 
invoke
public T invoke(@Nullable SNode operand, Object... parameters)
Description copied from interface:SMethodinvokes the method (trying to resolve the right method on runtime if it is virtual) essentially invokes the #invoke0 method with the concept of the operand 
- 
invoke
public T invoke(@Nullable SAbstractConcept operand, Object... parameters)
Description copied from interface:SMethodinvokes the method in the case it is static (trying to resolve the right method on runtime if it is virtual) 
- 
invoke0
public T invoke0(@Nullable SNode operand, @NotNull SAbstractConcept concreteConcept, Object... parameters)
Description copied from interface:SMethodinvokes the virtual method as if applied to the node of the concreteConcept 
- 
invoke0
public T invoke0(@Nullable SAbstractConcept operand, @NotNull SAbstractConcept concreteConcept, Object... parameters)
 
- 
invokeSpecial
public T invokeSpecial(@Nullable SNode operand, Object... parameters)
Description copied from interface:SMethodinvokes private method (no dynamic method resolve) generated from the super non-virtual invocations or the super<> invocations - Specified by:
 invokeSpecialin interfaceSMethod<T>
 
- 
invokeSpecial
public T invokeSpecial(@Nullable SAbstractConcept operand, Object... parameters)
Description copied from interface:SMethodinvokes private method (no dynamic method resolve)- Specified by:
 invokeSpecialin interfaceSMethod<T>
 
- 
invokeSuper
public T invokeSuper(@Nullable SNode operand, @NotNull SAbstractConcept concept, Object... parameters)
Description copied from interface:SMethodinvokes virtual method looking for the ancestors of the node's concept (dynamic method resolve)- Specified by:
 invokeSuperin interfaceSMethod<T>concept- is the concept from which the #invokeSuper is intended to be executed
 
- 
invokeSuper
public T invokeSuper(@Nullable SAbstractConcept operand, @NotNull SAbstractConcept concept, Object... parameters)
Description copied from interface:SMethodinvokes virtual method looking for the ancestors of the concept (dynamic method resolve)- Specified by:
 invokeSuperin interfaceSMethod<T>concept- is the concept from which the #invokeSuper is intended to be executed
 
- 
getReturnType
@NotNull public SAbstractType getReturnType()
- Specified by:
 getReturnTypein interfaceSMethod<T>- Returns:
 - the return type of the SMethod
 
 
- 
getParameters
public List<SParameter> getParameters()
- Specified by:
 getParametersin interfaceSExecutable- Returns:
 - the parameters description
 - See Also:
 SParameter
 
- 
getExceptions
public List<SThrowable> getExceptions()
- Specified by:
 getExceptionsin interfaceSExecutable- Returns:
 - the declared throwable exceptions description
 - See Also:
 SThrowable
 
- 
getModifiers
@NotNull public SModifiers getModifiers()
- Specified by:
 getModifiersin interfaceSExecutable- Returns:
 - modifiers of the method (public/private, virtual, etc.)
 - See Also:
 SModifiers
 
- 
isVirtual
public boolean isVirtual()
- Specified by:
 isVirtualin interfaceSMethod<T>- Returns:
 - true iff the method has a virtual modifier
 - See Also:
 SExecutable.getModifiers()
 
- 
isAbstract
public boolean isAbstract()
Description copied from interface:SMethodabstract => virtual- Specified by:
 isAbstractin interfaceSMethod<T>- Returns:
 - true iff the method has an abstract modifier
 
 
- 
isStatic
public boolean isStatic()
- Specified by:
 isStaticin interfaceSMethod<T>- Returns:
 - true iff the method has a static modifier
 - See Also:
 SExecutable.getModifiers()
 
- 
getConcept
@NotNull public SAbstractConcept getConcept()
Description copied from interface:SExecutableSExecutable must belong to some concept For example in the case of SMethod the concept is the concept where the method is declared- Specified by:
 getConceptin interfaceSExecutable- Returns:
 - the concept which this executable belongs to
 
 
- 
getName
@NotNull public String getName()
Description copied from interface:SNamedElementPresentation of the element for an end-user. Unlike identity, the name is deemed user-friendly and shall not be used for persistence.- Specified by:
 getNamein interfaceSNamedElement- Returns:
 - name of the meta element
 
 
- 
isPublic
public boolean isPublic()
 
 - 
 
 -