package jetbrains.mps.lang.behavior.generator.template.util;
/*Generated by MPS */
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.core.aspects.behaviour.SMethodTrimmedId;
import jetbrains.mps.baseLanguage.behavior.BaseMethodDeclaration__BehaviorDescriptor;
/**
* TODO need to be moved to the behavior of the ConceptBehavior after MPS project rebuilt
*/
public final class MethodNameHelper {
private final SNode myMethodDecl;
public MethodNameHelper(@NotNull SNode methodDecl) {
myMethodDecl = methodDecl;
}
@NotNull
public String getGeneratedString() {
return getGeneratedName() + "_id" + getGeneratedId();
}
@NotNull
public String getGeneratedName() {
return SPropertyOperations.getString(getBaseMethod(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
@NotNull
public String getGeneratedId() {
SNode baseMethod = getBaseMethod();
return SMethodTrimmedId.toText(baseMethod.getNodeId());
}
private SNode getBaseMethod() {
SNode baseMethod = myMethodDecl;
if (BaseMethodDeclaration__BehaviorDescriptor.getBaseMethod_id4mmymf_0z7l.invoke(myMethodDecl) != null) {
baseMethod = BaseMethodDeclaration__BehaviorDescriptor.getBaseMethod_id4mmymf_0z7l.invoke(myMethodDecl);
}
return baseMethod;
}
}