Package org.jetbrains.mps.openapi.model
Class SModelName
- java.lang.Object
- 
- org.jetbrains.mps.openapi.model.SModelName
 
- 
 public final class SModelName extends Object Name of a model is complicated matter, we distinguish qualified/long and simple name, namespace fraction, and optional stereotype fraction of it.[ {namespace} '.'] {simple name} [ '@' {stereotype} ]To avoid use of utility methods scattered around the code that extract certain fractions of the model name, this object gives access to all relevant parts of the name.- Since:
- 3.4
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSModelName.SModelNameCheckPossible SModelName check results.
 - 
Constructor SummaryConstructors Constructor Description SModelName(CharSequence qualifiedName, CharSequence stereotype)SModelName(CharSequence namespace, CharSequence simpleName, CharSequence stereotype)SModelName(String qualifiedCompleteName)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SModelName.SModelNameCheckcheckModelName(CharSequence longName, CharSequence stereotype)Checks if SModelName can be constructed with such inputstatic SModelName.SModelNameCheckcheckModelName(CharSequence namespace, CharSequence simpleName, CharSequence stereotype)Checks if SModelName can be constructed with such inputstatic SModelName.SModelNameCheckcheckModelName(String fullName)Checks if SModelName can be constructed with such inputbooleanequals(Object obj)StringgetLongName()StringgetNamespace()StringgetShortNameWithStereotype()Similar togetSimpleName(), just keeps stereotype part, if anyStringgetSimpleName()StringgetStereotype()StringgetValue()inthashCode()booleanhasStereotype()booleanhasStereotype(CharSequence stereotype)booleanisEmpty()Covers the case when we constructed aSModelReferencewithSModelIdonly, unaware of actual model name.StringtoString()SModelNamewithoutStereotype()Construct a name with the identical qualified name, and without any stereotype.SModelNamewithStereotype(CharSequence newStereotype)
 
- 
- 
- 
Constructor Detail- 
SModelNamepublic SModelName(@NotNull String qualifiedCompleteName) - Throws:
- IllegalArgumentException- if name contains illegal characters
 
 - 
SModelNamepublic SModelName(@Nullable CharSequence namespace, @NotNull CharSequence simpleName, @Nullable CharSequence stereotype) - Throws:
- IllegalArgumentException- if any component of a model name contains illegal characters
 
 - 
SModelNamepublic SModelName(@NotNull CharSequence qualifiedName, @Nullable CharSequence stereotype) - Throws:
- IllegalArgumentException- if any component of a model name contains illegal characters
 
 
- 
 - 
Method Detail- 
isEmptypublic boolean isEmpty() Covers the case when we constructed aSModelReferencewithSModelIdonly, unaware of actual model name.- Returns:
- trueiff model name is blank.
 
 - 
getValue@NotNull public String getValue() - Returns:
- complete name of the model which includes optional namespace part, model name and optional stereotype, such as 'generator' or 'tests', separated by the '@' character e.g. 'jetbrains.mps.sample.generator.main@generator'
 
 - 
getLongName@NotNull public String getLongName() - Returns:
- qualified model name (namespace and simple name), without stereotype
 
 - 
getSimpleName@NotNull public String getSimpleName() - Returns:
- name of the model without namespace nor stereotype, empty string iff model name is blank.
 
 - 
getShortNameWithStereotype@NotNull public String getShortNameWithStereotype() Similar togetSimpleName(), just keeps stereotype part, if any- Returns:
- name of the model without namespace but with stereotype, if any.
 
 - 
hasStereotypepublic boolean hasStereotype() - Returns:
- trueiff- getStereotype()would return non-empty value
 
 - 
hasStereotypepublic boolean hasStereotype(@Nullable CharSequence stereotype) - Returns:
- trueiff- stereotypematches the argument. Name without stereotype matches both- nulland- ""argument values.
- Since:
- 2018.3
 
 - 
withStereotype@NotNull public SModelName withStereotype(@Nullable CharSequence newStereotype) - Parameters:
- newStereotype- stereotype for the constructed name or- nullto indicate that new name should not specify stereotype (identical to- withoutStereotype()
- Returns:
- model name with qualified name identical to this model name and with a given stereotype. May return same instance if new stereotype is the same as actual.
 
 - 
withoutStereotype@NotNull public SModelName withoutStereotype() Construct a name with the identical qualified name, and without any stereotype. May returnthisif there's no stereotype in the actual name (SModelNameis immutable).- Returns:
- model name without a stereotype, never null
 
 - 
checkModelName@NotNull public static SModelName.SModelNameCheck checkModelName(@Nullable CharSequence namespace, @NotNull CharSequence simpleName, @Nullable CharSequence stereotype) Checks if SModelName can be constructed with such input
 - 
checkModelName@NotNull public static SModelName.SModelNameCheck checkModelName(@NotNull CharSequence longName, @Nullable CharSequence stereotype) Checks if SModelName can be constructed with such input
 - 
checkModelName@NotNull public static SModelName.SModelNameCheck checkModelName(String fullName) Checks if SModelName can be constructed with such input
 
- 
 
-