Class TagValueUtil


  • public class TagValueUtil
    extends Object
    Created on 24/09/16.
    Author:
    Tony Chemit - chemit@codelutin.com
    • Field Detail

      • TAG_VALUE_PATTERN

        protected static final Pattern TAG_VALUE_PATTERN
        Pattern to define tag values authorized at classifier level in the model properties file. L'expression réguliere match les chaines de type <package.ClassName>.<class|attribute|operation>.[name].<stereotype|tagvalue>.[tag] fr.isisfish.entities.Population.class.stereotype=entity fr.isisfish.entities.Population.class.tagvalue.persistenceType=flatfile fr.isisfish.entities.Population.attribute.name.stereotype=... fr.isisfish.entities.Population.attribute.name.tagvalue.pk=topiaId fr.isisfish.entities.Population.operation.getRegion.stereotype=... fr.isisfish.entities.Population.operation.getRegion.tagvalue.pk=...
      • MODEL_TAG_VALUE_PATTERN

        protected static final Pattern MODEL_TAG_VALUE_PATTERN
        Pattern to define tag values authorized at model level in the model properties file.
      • PACKAGE_TAG_VALUE_PATTERN

        protected static final Pattern PACKAGE_TAG_VALUE_PATTERN
        Pattern to define tag values authorized at model level in the model properties file.
      • PACKAGE_STEREOTYPE_PATTERN

        protected static final Pattern PACKAGE_STEREOTYPE_PATTERN
      • STEREOTYPE_PATTERN

        protected static final Pattern STEREOTYPE_PATTERN
    • Constructor Detail

      • TagValueUtil

        public TagValueUtil()
    • Method Detail

      • findTagValue

        public static String findTagValue​(TagValueMetadata tagName,
                                          WithTagValuesOrStereotypes... elements)
        Seek for a tag value amoung elements given using these rules:
        • Look into elements and return the first not empty tag value found.
        • If not found, Look into elements declaringElement (for each element that is a ObjectModelElement and return the first not empty tag value found.
        • If not found return defaultValue
        Note: Order of elements is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).
        Parameters:
        tagName - tag name to find
        elements - not null elements to test
        Returns:
        found tag value or null if not found
        Since:
        3.0
      • findTagValue

        public static String findTagValue​(String tagName,
                                          String defaultValue,
                                          WithTagValuesOrStereotypes... elements)
        Seek for a tag value amoung elements given using these rules:
        • Look into elements and return the first not empty tag value found.
        • If not found, Look into elements declaringElement (for each element that is a ObjectModelElement and return the first not empty tag value found.
        • If not found return defaultValue
        Note: Order of elements is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).
        Parameters:
        tagName - tag name to find
        defaultValue - default value to use if not found
        elements - not null elements to test
        Returns:
        found tag value or defaultValue if not found
        Since:
        3.0
      • findNullableBooleanTagValue

        public static Boolean findNullableBooleanTagValue​(TagValueMetadata tagName,
                                                          WithTagValuesOrStereotypes... elements)
        Seek for a Boolean tag value. Will first the tag value using the method findTagValue(TagValueMetadata, WithTagValuesOrStereotypes...). If not found, return null, otherwise return boolean value (case is ignored). Note: Order of elements is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).
        Parameters:
        tagName - tag name to find
        elements - not null elements to test
        Returns:
        found boolean tag value or null if tag value not found.
        Since:
        3.0
      • findDirectTagValue

        public static String findDirectTagValue​(TagValueMetadata tagName,
                                                WithTagValuesOrStereotypes... elements)
        Seek for a tag value amoung elements given using these rules:
        • Look into elements and return the first not empty tag value found.
        • If not found return defaultValue
        Note: Order of elements is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).
        Parameters:
        tagName - tag name to find
        elements - not null elements to test
        Returns:
        found tag value or null if not found
        Since:
        3.0
      • findDirectTagValue

        public static String findDirectTagValue​(String tagName,
                                                WithTagValuesOrStereotypes... elements)
        Seek for a tag value amoung elements given using these rules:
        • Look into elements and return the first not empty tag value found.
        • If not found return defaultValue
        Note: Order of elements is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).
        Parameters:
        tagName - tag name to find
        elements - not null elements to test
        Returns:
        found tag value or null if not found
        Since:
        3.0
      • getStereotypes

        public static Set<String> getStereotypes​(String value)