Package jetbrains.mps.smodel
Class SReference
- java.lang.Object
 - 
- jetbrains.mps.smodel.SReference
 
 
- 
- All Implemented Interfaces:
 SReference
- Direct Known Subclasses:
 PostponedReference,SReferenceBase
public abstract class SReference extends Object implements SReference
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSReference.ProblemDescription 
- 
Field Summary
Fields Modifier and Type Field Description static SReference[]EMPTY_ARRAYprotected SNodemySourceNode 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedSReference(String role, SNode sourceNode)Deprecated.protectedSReference(SReferenceLink role, SNode sourceNode) 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SReferencecreate(String role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId)Deprecated.static SReferencecreate(SReferenceLink role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId)static SReferencecreate(SReferenceLink role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId, String resolveInfo)static SReferencecreate(SReferenceLink id, SNode sourceNode, SNode targetNode)static SReferencecreate(SReferenceLink role, SNode sourceNode, SNodeReference pointer, String resolveInfo)static booleandisableLogging()static voidenableLogging()protected voiderror(String message, boolean onlyWarn, SReference.ProblemDescription... problems)prints error to logSReferenceLinkgetLink()Gets the associated Link - an abstract meta-definition for the referenceStringgetResolveInfo()StringgetRole()Deprecated.SNodegetSourceNode()Containing node for this reference.SNodegetTargetNode()Resolves the target node in the containing repository.protected abstract SNodegetTargetNode_internal()SNodeIdgetTargetNodeId()SNodeReferencegetTargetNodeReference()Builds and returns a reference to the target node.static SNodegetTargetNodeSilently(SReference ref)abstract SModelReferencegetTargetSModelReference()The following two operations are defined only for references which can instantly respond to the request (e.g.voidmakeDirect()booleanmakeIndirect()voidsetResolveInfo(String info) 
 - 
 
- 
- 
Field Detail
- 
EMPTY_ARRAY
public static final SReference[] EMPTY_ARRAY
 
- 
mySourceNode
protected final SNode mySourceNode
 
 - 
 
- 
Constructor Detail
- 
SReference
@Deprecated protected SReference(String role, SNode sourceNode)
Deprecated.role must be "genuine", interned 
- 
SReference
protected SReference(SReferenceLink role, SNode sourceNode)
 
 - 
 
- 
Method Detail
- 
create
public static SReference create(SReferenceLink id, SNode sourceNode, SNode targetNode)
 
- 
create
public static SReference create(SReferenceLink role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId)
 
- 
create
public static SReference create(SReferenceLink role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId, String resolveInfo)
 
- 
create
public static SReference create(SReferenceLink role, SNode sourceNode, SNodeReference pointer, String resolveInfo)
 
- 
create
@Deprecated public static SReference create(String role, SNode sourceNode, SModelReference targetModelReference, SNodeId targetNodeId)
Deprecated. 
- 
disableLogging
public static boolean disableLogging()
- Returns:
 - Whether logging was really disabled by this call, i.e. it wasn't already disabled before
 
 
- 
enableLogging
public static void enableLogging()
 
- 
getTargetNodeSilently
public static SNode getTargetNodeSilently(SReference ref)
 
- 
getRole
@Deprecated public String getRole()
Deprecated.- Specified by:
 getRolein interfaceSReference
 
- 
getLink
public SReferenceLink getLink()
Description copied from interface:SReferenceGets the associated Link - an abstract meta-definition for the reference- Specified by:
 getLinkin interfaceSReference
 
- 
getSourceNode
public SNode getSourceNode()
Description copied from interface:SReferenceContaining node for this reference.- Specified by:
 getSourceNodein interfaceSReference
 
- 
getTargetNode
public final SNode getTargetNode()
Description copied from interface:SReferenceResolves the target node in the containing repository. This operation is not guaranteed to be fast. It may require to traverse the repository, compute types for some nodes or execute code provided by the language-designer.- Specified by:
 getTargetNodein interfaceSReference- Returns:
 - the node behind the reference, or null if something is broken in the repository
 
 
- 
getTargetNodeReference
public SNodeReference getTargetNodeReference()
Description copied from interface:SReferenceBuilds and returns a reference to the target node. Tries to avoid lengthy computations whenever possible. Does exactly the same as getTargetNode().getReference(), but probably faster.- Specified by:
 getTargetNodeReferencein interfaceSReference
 
- 
getTargetSModelReference
@Nullable public abstract SModelReference getTargetSModelReference()
Description copied from interface:SReferenceThe following two operations are defined only for references which can instantly respond to the request (e.g. they store the target model reference and/or node id as a part of the reference).- Specified by:
 getTargetSModelReferencein interfaceSReference- Returns:
 - target model reference (if available)
 
 
- 
getTargetNodeId
@Nullable public SNodeId getTargetNodeId()
- Specified by:
 getTargetNodeIdin interfaceSReference
 
- 
makeDirect
public void makeDirect()
 
- 
makeIndirect
public boolean makeIndirect()
 
- 
getResolveInfo
public String getResolveInfo()
 
- 
setResolveInfo
public void setResolveInfo(String info)
 
- 
getTargetNode_internal
protected abstract SNode getTargetNode_internal()
 
- 
error
protected final void error(String message, boolean onlyWarn, SReference.ProblemDescription... problems)
prints error to log- Parameters:
 onlyWarn- if true then warning must be printed out. Must be true almost always.
 
 - 
 
 -