Package com.nomagic.magicdraw.uml.text
Class CoreTextCreator
- java.lang.Object
-
- com.nomagic.magicdraw.uml.text.CoreTextCreator
-
- Direct Known Subclasses:
ModelTextCreator
@OpenApiAll public class CoreTextCreator extends java.lang.ObjectContains methods to create representation text for model elements that are commonly used as property values of other elements
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNEW_LINE_SEPARATORstatic java.lang.StringTYPE_SEPARATORstatic java.lang.StringVALUE_SEPARATOR
-
Constructor Summary
Constructors Constructor Description CoreTextCreator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static booleancontainsParentheses(java.lang.String string)static TextBuildercreateElementNumberText(Element element, java.util.function.Supplier<TextBuilder> builderFactory)Create the element's number (auto id) textstatic java.lang.StringcreateMultiplicityRangeText(java.lang.Integer range)Creates multiplicity range text.static TextBuildercreateMultiplicityText(TextBuilder lower, TextBuilder upper, boolean ordered, boolean unique, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Returns text representation of given multiplicity.static TextBuildercreateMultiplicityText(TextBuilder lower, TextBuilder upper, ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of the provided multiplicity range.static TextBuildercreateMultiplicityText(MultiplicityElement element, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Creates text representation of given elementMultiplicityElement.static java.lang.StringcreateMultiplicityText(java.lang.Integer lower, java.lang.Integer upper)Creates multiplicity text.static java.lang.StringcreateMultiplicityText(java.lang.String lower, java.lang.String upper, boolean ordered, boolean unique, MultiplicityTextParams textParams)Creates text representation of given multiplicity range.static java.lang.StringcreateMultiplicityText(java.lang.String lower, java.lang.String upper, ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams)Creates string representation of the provided multiplicity range.static TextBuildercreateNamedElementListText(java.util.List<? extends NamedElement> elements, java.util.function.Supplier<TextBuilder> builderFactory)Creates representation text for a list of named elements, which contains names separated by a comma.static TextBuildercreateStereotypesText(Element element, java.lang.String separator, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of stereotypes that are applied to the provided elementstatic TextBuildercreateStereotypesText(java.util.Collection<Stereotype> stereotypes, java.lang.String separator, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation for the collection ofStereotypeelements.static TextBuildercreateStereotypeText(Stereotype stereotype, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of the givenStereotype.static java.lang.StringcreateStereotypeText(java.lang.String stereotypeName)static TextBuildercreateStringCollectionText(java.util.Collection<java.lang.String> strings, java.lang.String separator, java.util.function.Supplier<TextBuilder> builderFactory)Joins stringsstatic TextBuildercreateStyledTypeText(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)Creates colored string representation of the givenType.static TextBuildercreateStyledTypeTextWithSeparator(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)Creates colored string representation of the givenType.static TextBuildercreateTypeText(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of the givenType.static TextBuildercreateTypeText(java.util.Collection<? extends Type> types, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of the givenTypeelements, separated by comma.static TextBuildercreateValueSpecificationText(ValueSpecification valueSpecification, boolean addBraces, java.util.function.Supplier<TextBuilder> builderFactory)Creates string representation of the givenValueSpecification.static <T extends TextBuilder>
TcreateValueSpecificationText(ValueSpecification valueSpecification, java.util.function.Supplier<T> builderFactory)Creates string representation of the givenValueSpecificationwith no braces.static java.lang.StringcreateVisibilityText(VisibilityKind visibility)Returns visibility representation(+, # or -)static booleanisUseStandardStereotypeChar()protected static <T> TextBuilderjoin(TextBuilder textBuilder, java.lang.String delimiter, java.util.stream.Stream<T> elements, java.util.function.Function<T,TextBuilder> map)static voidsetUseStandardStereotypeChar(boolean useStandardStereotypeChar)
-
-
-
Field Detail
-
TYPE_SEPARATOR
public static final java.lang.String TYPE_SEPARATOR
- See Also:
- Constant Field Values
-
NEW_LINE_SEPARATOR
public static final java.lang.String NEW_LINE_SEPARATOR
- See Also:
- Constant Field Values
-
VALUE_SEPARATOR
public static final java.lang.String VALUE_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
isUseStandardStereotypeChar
public static boolean isUseStandardStereotypeChar()
-
setUseStandardStereotypeChar
public static void setUseStandardStereotypeChar(boolean useStandardStereotypeChar)
-
createTypeText
public static TextBuilder createTypeText(java.util.Collection<? extends Type> types, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of the givenTypeelements, separated by comma.- Parameters:
types- collection of typesshowQualifiedName- true to include type's qualified namebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the types' text appended
-
createTypeText
public static TextBuilder createTypeText(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of the givenType.- Parameters:
type- element to create representation text forshowQualifiedName- true to include type's qualified namebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the type's text appended
-
createStyledTypeText
public static TextBuilder createStyledTypeText(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)
Creates colored string representation of the givenType.- Parameters:
type- element to create representation text forshowQualifiedName- true to include type's qualified namebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the type's text appended
-
createStyledTypeTextWithSeparator
public static TextBuilder createStyledTypeTextWithSeparator(Type type, boolean showQualifiedName, java.util.function.Supplier<TextBuilder> builderFactory)
Creates colored string representation of the givenType. Pre-appends CoreTextCreator.TYPE_SEPARATOR- Parameters:
type- element to create representation text forshowQualifiedName- true to include type's qualified namebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the type's text appended
-
createStringCollectionText
public static TextBuilder createStringCollectionText(java.util.Collection<java.lang.String> strings, java.lang.String separator, java.util.function.Supplier<TextBuilder> builderFactory)
Joins strings- Parameters:
strings- strings to joinseparator- symbol(s) to separate each string withbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the joined strings appended
-
createNamedElementListText
public static TextBuilder createNamedElementListText(java.util.List<? extends NamedElement> elements, java.util.function.Supplier<TextBuilder> builderFactory)
Creates representation text for a list of named elements, which contains names separated by a comma. Only names of the first 5 elements are included, and "..." is added in there are more elements in the list.- Parameters:
elements- to create joined named representation for- Returns:
- builder with the element names appended
-
createValueSpecificationText
public static TextBuilder createValueSpecificationText(@CheckForNull ValueSpecification valueSpecification, boolean addBraces, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of the givenValueSpecification.- Parameters:
valueSpecification- element to create representation text foraddBraces- true to add braces around the value specification textbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the value specification's text appended
-
createValueSpecificationText
public static <T extends TextBuilder> T createValueSpecificationText(@CheckForNull ValueSpecification valueSpecification, java.util.function.Supplier<T> builderFactory)
Creates string representation of the givenValueSpecificationwith no braces.- Parameters:
valueSpecification- element to create representation text forbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the value specification's text appended
-
createMultiplicityText
public static java.lang.String createMultiplicityText(java.lang.String lower, java.lang.String upper, @CheckForNull ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams)Creates string representation of the provided multiplicity range.- Parameters:
lower- lower bounds of the multiplicityupper- upper bounds of the multiplicitylowerValue- value specification element that holds the value of the lower boundsordered- is orderedunique- is uniquetextParams- text parameters- Returns:
- builder with the multiplicity's text appended
-
createMultiplicityText
public static TextBuilder createMultiplicityText(TextBuilder lower, TextBuilder upper, @CheckForNull ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of the provided multiplicity range.- Parameters:
lower- lower bounds of the multiplicityupper- upper bounds of the multiplicitylowerValue- value specification element that holds the value of the lower boundsordered- is orderedunique- is uniquetextParams- text parameters- Returns:
- builder with the multiplicity's text appended
-
createMultiplicityRangeText
public static java.lang.String createMultiplicityRangeText(@CheckForNull java.lang.Integer range)Creates multiplicity range text.- Parameters:
range- multiplicity range.- Returns:
- multiplicity range string representation.
-
createMultiplicityText
public static java.lang.String createMultiplicityText(@CheckForNull java.lang.Integer lower, @CheckForNull java.lang.Integer upper)Creates multiplicity text.- Parameters:
lower- Lower range.upper- Upper range.- Returns:
- representation text of multiplicity value.
-
createMultiplicityText
public static TextBuilder createMultiplicityText(TextBuilder lower, TextBuilder upper, boolean ordered, boolean unique, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Returns text representation of given multiplicity.- Parameters:
lower- Lower valueupper- Upper valueordered- orderedunique- uniquetextParams- text parameters- Returns:
- builder with multiplicity's representation or empty string if multiplicity is null.
-
createMultiplicityText
public static java.lang.String createMultiplicityText(@CheckForNull java.lang.String lower, @CheckForNull java.lang.String upper, boolean ordered, boolean unique, MultiplicityTextParams textParams)Creates text representation of given multiplicity range.- Parameters:
lower- Lower valueupper- Upper valueordered- orderedunique- uniquetextParams- text parameters- Returns:
- text representation or empty string if multiplicity is null
-
createMultiplicityText
public static TextBuilder createMultiplicityText(@CheckForNull MultiplicityElement element, MultiplicityTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Creates text representation of given elementMultiplicityElement.- Parameters:
element- the given multiplicity elementtextParams- text parametersbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the multiplicity text appended
-
join
protected static <T> TextBuilder join(TextBuilder textBuilder, java.lang.String delimiter, java.util.stream.Stream<T> elements, java.util.function.Function<T,TextBuilder> map)
-
createVisibilityText
public static java.lang.String createVisibilityText(@CheckForNull VisibilityKind visibility)Returns visibility representation(+, # or -)- Parameters:
visibility- the given visibility.- Returns:
- the char representation of given visibility.
-
createStereotypesText
public static TextBuilder createStereotypesText(Element element, java.lang.String separator, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of stereotypes that are applied to the provided element- Parameters:
element- to create representation text forseparator- symbol(s) to separate each stereotype's text withtextParams- text parametersbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the stereotypes' text appended
-
createStereotypesText
public static TextBuilder createStereotypesText(java.util.Collection<Stereotype> stereotypes, java.lang.String separator, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation for the collection ofStereotypeelements.- Parameters:
stereotypes- collection of stereotypes to create representation text forseparator- symbol(s) to separate each stereotype's text withtextParams- configuration that defines what to include in the text of each stereotypebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the stereotypes' text appended
-
createStereotypeText
public static TextBuilder createStereotypeText(Stereotype stereotype, StereotypeTextParams textParams, java.util.function.Supplier<TextBuilder> builderFactory)
Creates string representation of the givenStereotype.- Parameters:
stereotype- element to create representation text fortextParams- configuration that defines what to include in the text of the stereotypebuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the stereotype's text appended
-
createStereotypeText
public static java.lang.String createStereotypeText(@CheckForNull java.lang.String stereotypeName)
-
containsParentheses
protected static boolean containsParentheses(java.lang.String string)
-
createElementNumberText
public static TextBuilder createElementNumberText(Element element, java.util.function.Supplier<TextBuilder> builderFactory)
Create the element's number (auto id) text- Parameters:
element- the element that can be numberedbuilderFactory- providesTextBuilderto append the created text to- Returns:
- builder with the number + space at the end or empty string if the number is not available
-
-