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 - chemit@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description protected static Pattern
MODEL_TAG_VALUE_PATTERN
Pattern to define tag values authorized at model level in the model properties file.protected static Pattern
PACKAGE_STEREOTYPE_PATTERN
protected static Pattern
PACKAGE_TAG_VALUE_PATTERN
Pattern to define tag values authorized at model level in the model properties file.protected static Pattern
STEREOTYPE_PATTERN
protected static Pattern
TAG_VALUE_PATTERN
Pattern 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 boolean
findBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
static String
findDirectTagValue(String tagName, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules: Look intoelements
and return the first not empty tag value found. If not found returndefaultValue
Note: Order ofelements
is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static String
findDirectTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules: Look intoelements
and return the first not empty tag value found. If not found returndefaultValue
Note: Order ofelements
is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static String
findNotEmptyTagValue(String tagName, WithTagValuesOrStereotypes element)
protected static String
findNotEmptyTagValue(String tagName, ObjectModelPackage element)
static String
findNotEmptyTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes element)
protected static String
findNotEmptyTagValue(TagValueMetadata tagName, ObjectModelPackage element)
static Boolean
findNullableBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
Seek for a Boolean tag value.static String
findTagValue(String tagName, String defaultValue, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules: Look intoelements
and return the first not empty tag value found. If not found, Look intoelements
declaringElement (for each element that is aObjectModelElement
and return the first not empty tag value found. If not found returndefaultValue
Note: Order ofelements
is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static String
findTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
Seek for a tag value amoung elements given using these rules: Look intoelements
and return the first not empty tag value found. If not found, Look intoelements
declaringElement (for each element that is aObjectModelElement
and return the first not empty tag value found. If not found returndefaultValue
Note: Order ofelements
is important, better then to always starts from specialized to more general level (for example from attribute, to classifier or model).static Matcher
getMatcher(String key)
static Matcher
getModelMatcher(String key)
static Matcher
getPackageMatcher(String key)
static Matcher
getPackageStereotypeMatcher(String key)
static Matcher
getStereotypeMatcher(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
elements
and return the first not empty tag value found. - If not found, Look into
elements
declaringElement (for each element that is aObjectModelElement
and return the first not empty tag value found. - If not found return
defaultValue
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 findelements
- not null elements to test- Returns:
- found tag value or
null
if 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
elements
and return the first not empty tag value found. - If not found, Look into
elements
declaringElement (for each element that is aObjectModelElement
and return the first not empty tag value found. - If not found return
defaultValue
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 finddefaultValue
- default value to use if not foundelements
- not null elements to test- Returns:
- found tag value or
defaultValue
if not found - Since:
- 3.0
- Look into
-
findBooleanTagValue
public static boolean findBooleanTagValue(TagValueMetadata tagName, WithTagValuesOrStereotypes... elements)
-
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 ofelements
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 findelements
- 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
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 findelements
- not null elements to test- Returns:
- found tag value or
null
if 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
elements
and return the first not empty tag value found. - If not found return
defaultValue
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 findelements
- not null elements to test- Returns:
- found tag value or
null
if 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
-
-