Interface RegexElement
-
public interface RegexElementInterface to add regex pattern to elements, thus the following attributes: pattern (the regex, it will be tested if it compiles), not mandatory pattern-error-message, mandatory when pattern is added (in PresentationML it is translated to data-pattern-error-message) Simply implement it into the element when you want to add regex support Beware: If the element implementing this interface overridesElement.validate()and/orElement.buildAttribute(org.symphonyoss.symphony.messageml.MessageMLParser, Node)and/orElement.asPresentationML(XmlPrintStream, org.symphonyoss.symphony.messageml.MessageMLContext)without calling super, it is needed to manage manually PATTERN_ATTR and PATTERN_ERROR_MESSAGE_ATTR in these methods- Author:
- enrico.molino (12/05/2020)
-
-
Field Summary
Fields Modifier and Type Field Description static List<String>ALL_REGEX_ATTRSstatic StringATTRIBUTE_MANDATORY_WHEN_ATTRIBUTE_DEFINED_ERRstatic StringATTRIBUTE_TOO_LONG_ERRstatic StringPATTERN_ATTRstatic StringPATTERN_ERROR_MESSAGE_ATTRstatic intPATTERN_ERROR_MESSAGE_MAX_LENGTHstatic intPATTERN_MAX_LENGTHstatic StringPRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTRstatic StringREGEX_NOT_VALID_ERR
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringgetAttribute(String attr)Map<String,String>getAttributes()FormatEnumgetFormat()default Map<String,String>getOtherAttributes()default Map<String,String>getRegexAttrForPresentationML()Process MessageML attributes to build a map of regex related attributes for PresentationMLdefault voidvalidateRegex()Validate regex (it is called automatically bywhen this method is not overridden
-
-
-
Field Detail
-
PATTERN_ATTR
static final String PATTERN_ATTR
- See Also:
- Constant Field Values
-
PATTERN_ERROR_MESSAGE_ATTR
static final String PATTERN_ERROR_MESSAGE_ATTR
- See Also:
- Constant Field Values
-
PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR
static final String PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR
- See Also:
- Constant Field Values
-
PATTERN_MAX_LENGTH
static final int PATTERN_MAX_LENGTH
- See Also:
- Constant Field Values
-
PATTERN_ERROR_MESSAGE_MAX_LENGTH
static final int PATTERN_ERROR_MESSAGE_MAX_LENGTH
- See Also:
- Constant Field Values
-
ATTRIBUTE_MANDATORY_WHEN_ATTRIBUTE_DEFINED_ERR
static final String ATTRIBUTE_MANDATORY_WHEN_ATTRIBUTE_DEFINED_ERR
- See Also:
- Constant Field Values
-
ATTRIBUTE_TOO_LONG_ERR
static final String ATTRIBUTE_TOO_LONG_ERR
- See Also:
- Constant Field Values
-
REGEX_NOT_VALID_ERR
static final String REGEX_NOT_VALID_ERR
- See Also:
- Constant Field Values
-
-
Method Detail
-
validateRegex
default void validateRegex() throws InvalidInputExceptionValidate regex (it is called automatically bywhen this method is not overridden- Throws:
InvalidInputException
-
getRegexAttrForPresentationML
default Map<String,String> getRegexAttrForPresentationML()
Process MessageML attributes to build a map of regex related attributes for PresentationML- Returns:
- a map of PresentationML regex related attributes
-
getOtherAttributes
default Map<String,String> getOtherAttributes()
- Returns:
- all element's attributes that are not regex related
-
getFormat
FormatEnum getFormat()
-
-