Package com.nomagic.magicdraw.uml.text
Class CoreTextCreator
java.lang.Object
com.nomagic.magicdraw.uml.text.CoreTextCreator
- Direct Known Subclasses:
ModelTextCreator
Contains methods to create representation text for model elements that are commonly used as property values of other elements
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static booleancontainsParentheses(String string) static TextBuildercreateElementNumberText(Element element, Supplier<TextBuilder> builderFactory) Create the element's number (auto id) textstatic StringCreates multiplicity range text.static TextBuildercreateMultiplicityText(TextBuilder lower, TextBuilder upper, boolean ordered, boolean unique, MultiplicityTextParams textParams, Supplier<TextBuilder> builderFactory) Returns text representation of given multiplicity.static TextBuildercreateMultiplicityText(TextBuilder lower, TextBuilder upper, ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams, Supplier<TextBuilder> builderFactory) Creates string representation of the provided multiplicity range.static TextBuildercreateMultiplicityText(MultiplicityElement element, MultiplicityTextParams textParams, Supplier<TextBuilder> builderFactory) Creates text representation of given elementMultiplicityElement.static StringcreateMultiplicityText(Integer lower, Integer upper) Creates multiplicity text.static StringcreateMultiplicityText(String lower, String upper, boolean ordered, boolean unique, MultiplicityTextParams textParams) Creates text representation of given multiplicity range.static StringcreateMultiplicityText(String lower, String upper, ValueSpecification lowerValue, boolean unique, boolean ordered, MultiplicityTextParams textParams) Creates string representation of the provided multiplicity range.static TextBuildercreateNamedElementListText(List<? extends NamedElement> elements, Supplier<TextBuilder> builderFactory) Creates representation text for a list of named elements, which contains names separated by a comma.static TextBuildercreateStereotypesText(Element element, String separator, StereotypeTextParams textParams, Supplier<TextBuilder> builderFactory) Creates string representation of stereotypes that are applied to the provided elementstatic TextBuildercreateStereotypesText(Collection<Stereotype> stereotypes, String separator, StereotypeTextParams textParams, Supplier<TextBuilder> builderFactory) Creates string representation for the collection ofStereotypeelements.static TextBuildercreateStereotypeText(Stereotype stereotype, StereotypeTextParams textParams, Supplier<TextBuilder> builderFactory) Creates string representation of the givenStereotype.static StringcreateStereotypeText(String stereotypeName) static TextBuildercreateStringCollectionText(Collection<String> strings, String separator, Supplier<TextBuilder> builderFactory) Joins stringsstatic TextBuildercreateStyledTypeText(Type type, boolean showQualifiedName, Supplier<TextBuilder> builderFactory) Creates colored string representation of the givenType.static TextBuildercreateStyledTypeTextWithSeparator(Type type, boolean showQualifiedName, Supplier<TextBuilder> builderFactory) Creates colored string representation of the givenType.static TextBuildercreateTypeText(Type type, boolean showQualifiedName, Supplier<TextBuilder> builderFactory) Creates string representation of the givenType.static TextBuildercreateTypeText(Collection<? extends Type> types, boolean showQualifiedName, Supplier<TextBuilder> builderFactory) Creates string representation of the givenTypeelements, separated by comma.static TextBuildercreateValueSpecificationText(ValueSpecification valueSpecification, boolean addBraces, Supplier<TextBuilder> builderFactory) Creates string representation of the givenValueSpecification.static <T extends TextBuilder>
TcreateValueSpecificationText(ValueSpecification valueSpecification, Supplier<T> builderFactory) Creates string representation of the givenValueSpecificationwith no braces.static StringcreateVisibilityText(VisibilityKind visibility) Returns visibility representation(+, # or -)static booleanprotected static <T> TextBuilderjoin(TextBuilder textBuilder, String delimiter, Stream<T> elements, Function<T, TextBuilder> map) static voidsetUseStandardStereotypeChar(boolean useStandardStereotypeChar)
-
Field Details
-
TYPE_SEPARATOR
- See Also:
-
NEW_LINE_SEPARATOR
- See Also:
-
VALUE_SEPARATOR
- See Also:
-
-
Constructor Details
-
CoreTextCreator
public CoreTextCreator()
-
-
Method Details
-
isUseStandardStereotypeChar
public static boolean isUseStandardStereotypeChar() -
setUseStandardStereotypeChar
public static void setUseStandardStereotypeChar(boolean useStandardStereotypeChar) -
createTypeText
public static TextBuilder createTypeText(Collection<? extends Type> types, boolean showQualifiedName, 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, 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, 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, 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(Collection<String> strings, String separator, 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(List<? extends NamedElement> elements, 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, 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, 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 String createMultiplicityText(String lower, 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, 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
Creates multiplicity range text.- Parameters:
range- multiplicity range.- Returns:
- multiplicity range string representation.
-
createMultiplicityText
public static String createMultiplicityText(@CheckForNull Integer lower, @CheckForNull 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, 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 String createMultiplicityText(@CheckForNull String lower, @CheckForNull 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, 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, String delimiter, Stream<T> elements, Function<T, TextBuilder> map) -
createVisibilityText
Returns visibility representation(+, # or -)- Parameters:
visibility- the given visibility.- Returns:
- the char representation of given visibility.
-
createStereotypesText
public static TextBuilder createStereotypesText(Element element, String separator, StereotypeTextParams textParams, 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(Collection<Stereotype> stereotypes, String separator, StereotypeTextParams textParams, 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, 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
-
containsParentheses
-
createElementNumberText
public static TextBuilder createElementNumberText(Element element, 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
-