Class CoreTextCreator

java.lang.Object
com.nomagic.magicdraw.uml.text.CoreTextCreator
Direct Known Subclasses:
ModelTextCreator

@OpenApiAll public class CoreTextCreator extends Object
Contains methods to create representation text for model elements that are commonly used as property values of other elements
  • Field Details

  • 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 given Type elements, separated by comma.
      Parameters:
      types - collection of types
      showQualifiedName - true to include type's qualified name
      builderFactory - provides TextBuilder to 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 given Type.
      Parameters:
      type - element to create representation text for
      showQualifiedName - true to include type's qualified name
      builderFactory - providesTextBuilder to 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 given Type.
      Parameters:
      type - element to create representation text for
      showQualifiedName - true to include type's qualified name
      builderFactory - provides TextBuilder to 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 given Type. Pre-appends CoreTextCreator.TYPE_SEPARATOR
      Parameters:
      type - element to create representation text for
      showQualifiedName - true to include type's qualified name
      builderFactory - providesTextBuilder to 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 join
      separator - symbol(s) to separate each string with
      builderFactory - providesTextBuilder to 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 given ValueSpecification.
      Parameters:
      valueSpecification - element to create representation text for
      addBraces - true to add braces around the value specification text
      builderFactory - providesTextBuilder to 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 given ValueSpecification with no braces.
      Parameters:
      valueSpecification - element to create representation text for
      builderFactory - providesTextBuilder to 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 multiplicity
      upper - upper bounds of the multiplicity
      lowerValue - value specification element that holds the value of the lower bounds
      ordered - is ordered
      unique - is unique
      textParams - 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 multiplicity
      upper - upper bounds of the multiplicity
      lowerValue - value specification element that holds the value of the lower bounds
      ordered - is ordered
      unique - is unique
      textParams - text parameters
      Returns:
      builder with the multiplicity's text appended
    • createMultiplicityRangeText

      public static String createMultiplicityRangeText(@CheckForNull Integer range)
      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 value
      upper - Upper value
      ordered - ordered
      unique - unique
      textParams - 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 value
      upper - Upper value
      ordered - ordered
      unique - unique
      textParams - 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 element MultiplicityElement.
      Parameters:
      element - the given multiplicity element
      textParams - text parameters
      builderFactory - provides TextBuilder to 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

      public static 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, 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 for
      separator - symbol(s) to separate each stereotype's text with
      textParams - text parameters
      builderFactory - provides TextBuilder to 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 of Stereotype elements.
      Parameters:
      stereotypes - collection of stereotypes to create representation text for
      separator - symbol(s) to separate each stereotype's text with
      textParams - configuration that defines what to include in the text of each stereotype
      builderFactory - provides TextBuilder to 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 given Stereotype.
      Parameters:
      stereotype - element to create representation text for
      textParams - configuration that defines what to include in the text of the stereotype
      builderFactory - provides TextBuilder to append the created text to
      Returns:
      builder with the stereotype's text appended
    • createStereotypeText

      public static String createStereotypeText(@CheckForNull String stereotypeName)
    • containsParentheses

      protected static boolean containsParentheses(String string)
    • 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 numbered
      builderFactory - provides TextBuilder to append the created text to
      Returns:
      builder with the number + space at the end or empty string if the number is not available