Class TagValueUtil
- java.lang.Object
-
- org.nuiton.eugene.models.extension.tagvalue.TagValueUtil
-
public class TagValueUtil extends Object
Created on 24/09/16.- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Field Summary
Fields Modifier and Type Field Description protected static PatternMODEL_TAG_VALUE_PATTERNPattern to define tag values authorized at model level in the model properties file.protected static PatternPACKAGE_STEREOTYPE_PATTERNprotected static PatternPACKAGE_TAG_VALUE_PATTERNPattern to define tag values authorized at model level in the model properties file.protected static PatternSTEREOTYPE_PATTERNprotected static PatternTAG_VALUE_PATTERNPattern to define tag values authorized at classifier level in the model properties file.
-
Constructor Summary
Constructors Constructor Description TagValueUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanfindBooleanTagValue(String value)static booleanfindBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)static StringfindDirectTagValue(String tagName, WithTagValuesOrStereotypes... elements)Seek for a tag value amoung elements given using these rules: Look intoelementsand return the first not empty tag value found. If not found returndefaultValueNote: Order ofelementsis important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static StringfindDirectTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)Seek for a tag value amoung elements given using these rules: Look intoelementsand return the first not empty tag value found. If not found returndefaultValueNote: Order ofelementsis important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static IntegerfindIntegerTagValue(String value)static StringfindNotEmptyTagValue(String tagName, WithTagValuesOrStereotypes element)protected static StringfindNotEmptyTagValue(String tagName, ObjectModelPackage element)static StringfindNotEmptyTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes element)protected static StringfindNotEmptyTagValue(TagValueMetadata tagName, ObjectModelPackage element)static BooleanfindNullableBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)Seek for a Boolean tag value.static StringfindTagValue(String tagName, String defaultValue, WithTagValuesOrStereotypes... elements)Seek for a tag value amoung elements given using these rules: Look intoelementsand return the first not empty tag value found. If not found, Look intoelementsdeclaringElement (for each element that is aObjectModelElementand return the first not empty tag value found. If not found returndefaultValueNote: Order ofelementsis important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static StringfindTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)Seek for a tag value amoung elements given using these rules: Look intoelementsand return the first not empty tag value found. If not found, Look intoelementsdeclaringElement (for each element that is aObjectModelElementand return the first not empty tag value found. If not found returndefaultValueNote: Order ofelementsis important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static MatchergetMatcher(String key)static MatchergetModelMatcher(String key)static MatchergetPackageMatcher(String key)static MatchergetPackageStereotypeMatcher(String key)static MatchergetStereotypeMatcher(String key)static Set<String>getStereotypes(String value)
-
-
-
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
-
-
Method Detail
-
getModelMatcher
public static Matcher getModelMatcher(String key) throws InvalidTagValueSyntaxException
- Throws:
InvalidTagValueSyntaxException
-
getPackageMatcher
public static Matcher getPackageMatcher(String key) throws InvalidTagValueSyntaxException
- Throws:
InvalidTagValueSyntaxException
-
getMatcher
public static Matcher getMatcher(String key) throws InvalidTagValueSyntaxException
- Throws:
InvalidTagValueSyntaxException
-
findTagValue
public static String findTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules:- Look into
elementsand return the first not empty tag value found. - If not found, Look into
elementsdeclaringElement (for each element that is aObjectModelElementand return the first not empty tag value found. - If not found return
defaultValue
elementsis 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 findelements- not null elements to test- Returns:
- found tag value or
nullif not found - Since:
- 3.0
- Look into
-
findTagValue
public static String findTagValue(String tagName, String defaultValue, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules:- Look into
elementsand return the first not empty tag value found. - If not found, Look into
elementsdeclaringElement (for each element that is aObjectModelElementand return the first not empty tag value found. - If not found return
defaultValue
elementsis 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 finddefaultValue- default value to use if not foundelements- not null elements to test- Returns:
- found tag value or
defaultValueif not found - Since:
- 3.0
- Look into
-
findBooleanTagValue
public static boolean findBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
-
findBooleanTagValue
public static boolean findBooleanTagValue(String value)
-
findNullableBooleanTagValue
public static Boolean findNullableBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
Seek for a Boolean tag value. Will first the tag value using the methodfindTagValue(TagValueMetadata, WithTagValuesOrStereotypes...). If not found, returnnull, otherwise return boolean value (case is ignored). Note: Order ofelementsis 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 findelements- not null elements to test- Returns:
- found boolean tag value or
nullif 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
elementsand return the first not empty tag value found. - If not found return
defaultValue
elementsis 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 findelements- not null elements to test- Returns:
- found tag value or
nullif not found - Since:
- 3.0
- Look into
-
findDirectTagValue
public static String findDirectTagValue(String tagName, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules:- Look into
elementsand return the first not empty tag value found. - If not found return
defaultValue
elementsis 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 findelements- not null elements to test- Returns:
- found tag value or
nullif not found - Since:
- 3.0
- Look into
-
findNotEmptyTagValue
public static String findNotEmptyTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes element)
-
findNotEmptyTagValue
public static String findNotEmptyTagValue(String tagName, WithTagValuesOrStereotypes element)
-
findNotEmptyTagValue
protected static String findNotEmptyTagValue(TagValueMetadata tagName, ObjectModelPackage element)
-
findNotEmptyTagValue
protected static String findNotEmptyTagValue(String tagName, ObjectModelPackage element)
-
getStereotypeMatcher
public static Matcher getStereotypeMatcher(String key) throws InvalidStereotypeSyntaxException
- Throws:
InvalidStereotypeSyntaxException
-
getPackageStereotypeMatcher
public static Matcher getPackageStereotypeMatcher(String key) throws InvalidStereotypeSyntaxException
- Throws:
InvalidStereotypeSyntaxException
-
-