Package dev.amp.validator
Class AMPValidatorManager
- java.lang.Object
-
- dev.amp.validator.AMPValidatorManager
-
public class AMPValidatorManager extends Object
This class manages the rules.- Author:
- nhant01, GeorgeLuo
-
-
Constructor Summary
Constructors Constructor Description AMPValidatorManager()Constructor of AMP validator manager class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<dev.amp.validator.ValidatorProtos.AttrSpec>getAmpLayoutAttrs()Returns the $AMP_LAYOUT_ATTRS attr spec list.dev.amp.validator.ValidatorProtos.AttrListgetAttrList(String name)Return a list of AttrList given an attribute list name.Map<String,dev.amp.validator.ValidatorProtos.AttrList>getAttrListMap()Returns the attr list map.StringgetCombinedDisallowedCdataRegex(int tagSpecId)Returns a combined disallowed listed regex.List<dev.amp.validator.ValidatorProtos.DescendantTagList>getDescendantTagLists()Returns the descendant tag lists.StringgetDispatchKeyByTagSpecId(int tagSpecId)Returns dispatch key given tag spec id.List<dev.amp.validator.ValidatorProtos.AttrSpec>getGlobalAttrs()Returns the $GLOBAL_ATTRS attr spec list.List<dev.amp.validator.ValidatorProtos.TagSpec>getListTagSpecByName(dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, String tagName)Return a list of TagSpec given a tag name.dev.amp.validator.ValidatorProtos.ValidatorRules.BuildergetRules()Returns the validation rules.StringgetScriptSpecUrl()Returns the script spec url.StringgetStylesSpecUrl()Returns the styles spec url.List<dev.amp.validator.ValidatorProtos.TagSpec>getTagSpec(dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, String name)Return a list of TagSpec given a tag name.intgetTagSpecIdByReferencePointTagSpecName(String specName)Returns the specId for given the tag spec name of the reference point.booleanhasTagSpec(dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, String name)Return true if tag spec name exists.voidloadRule()Loading AMP validator main and extensions rules.voidloadRule(String filePath)Loading AMP validator main and extensions rules.
-
-
-
Method Detail
-
loadRule
public void loadRule() throws IOException, URISyntaxExceptionLoading AMP validator main and extensions rules.- Throws:
IOException- if I/O errors occur.URISyntaxException- if this URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI.
-
loadRule
public void loadRule(String filePath) throws IOException, URISyntaxException
Loading AMP validator main and extensions rules.- Parameters:
filePath- file path.- Throws:
IOException- if I/O errors occur.URISyntaxException- if this URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI.
-
hasTagSpec
public boolean hasTagSpec(@Nonnull dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, @Nonnull String name)Return true if tag spec name exists.- Parameters:
htmlFormat- the HtmlFormat.name- tag spec name.- Returns:
- returns true if tag spec name exists.
-
getTagSpec
public List<dev.amp.validator.ValidatorProtos.TagSpec> getTagSpec(@Nonnull dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, @Nonnull String name)
Return a list of TagSpec given a tag name.- Parameters:
htmlFormat- the HtmlFormat.name- tag spec name.- Returns:
- returns a list of TagSpect given a tag name.
-
getAttrList
public dev.amp.validator.ValidatorProtos.AttrList getAttrList(@Nonnull String name)Return a list of AttrList given an attribute list name.- Parameters:
name- attribute list name.- Returns:
- returns a list of AttrList given an attribute spec name.
-
getListTagSpecByName
public List<dev.amp.validator.ValidatorProtos.TagSpec> getListTagSpecByName(@Nonnull dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat, @Nonnull String tagName)
Return a list of TagSpec given a tag name.- Parameters:
htmlFormat- the HtmlFormat.tagName- a tag name.- Returns:
- returns a list of TagSpec given a tag name.
-
getRules
public dev.amp.validator.ValidatorProtos.ValidatorRules.Builder getRules()
Returns the validation rules.- Returns:
- returns the validation rules.
-
getGlobalAttrs
public List<dev.amp.validator.ValidatorProtos.AttrSpec> getGlobalAttrs()
Returns the $GLOBAL_ATTRS attr spec list.- Returns:
- returns the $GLOBAL_ATTRS attr spec list.
-
getAmpLayoutAttrs
public List<dev.amp.validator.ValidatorProtos.AttrSpec> getAmpLayoutAttrs()
Returns the $AMP_LAYOUT_ATTRS attr spec list.- Returns:
- returns the $AMP_LAYOUT_ATTRS attr spec list.
-
getDescendantTagLists
public List<dev.amp.validator.ValidatorProtos.DescendantTagList> getDescendantTagLists()
Returns the descendant tag lists.- Returns:
- returns the descendant tag lists.
-
getDispatchKeyByTagSpecId
public String getDispatchKeyByTagSpecId(int tagSpecId)
Returns dispatch key given tag spec id.- Parameters:
tagSpecId- tag spec id.- Returns:
- returns dispatch key.
-
getTagSpecIdByReferencePointTagSpecName
public int getTagSpecIdByReferencePointTagSpecName(@Nonnull String specName) throws TagValidationExceptionReturns the specId for given the tag spec name of the reference point.- Parameters:
specName- the spec name.- Returns:
- returns specId.
- Throws:
TagValidationException- the TagValidationException.
-
getStylesSpecUrl
public String getStylesSpecUrl()
Returns the styles spec url.- Returns:
- returns the styles spec url.
-
getScriptSpecUrl
public String getScriptSpecUrl()
Returns the script spec url.- Returns:
- returns the script spec url.
-
getAttrListMap
public Map<String,dev.amp.validator.ValidatorProtos.AttrList> getAttrListMap()
Returns the attr list map.- Returns:
- returns the attr list map.
-
getCombinedDisallowedCdataRegex
public String getCombinedDisallowedCdataRegex(int tagSpecId)
Returns a combined disallowed listed regex.- Parameters:
tagSpecId- tag spec id.- Returns:
- returns a combined disallowed listed regex.
-
-