Class DispatchKeyUtils


  • public final class DispatchKeyUtils
    extends Object
    Dispatch key utility methods.
    Author:
    nhant01, GeorgeLuo
    • Method Detail

      • makeDispatchKey

        public static String makeDispatchKey​(@Nonnull
                                             dev.amp.validator.ValidatorProtos.AttrSpec.DispatchKeyType dispatchKeyType,
                                             @Nonnull
                                             String attrName,
                                             @Nonnull
                                             String attrValue,
                                             @Nonnull
                                             String mandatoryParent)
        DispatchKey represents a tuple of either 1-3 strings: - attribute name - attribute value (optional) - mandatory parent html tag (optional) A Dispatch key can be generated from some validator TagSpecs. One dispatch key per attribute can be generated from any HTML tag. If one of the dispatch keys for an HTML tag match that of a a TagSpec, we validate that HTML tag against only this one TagSpec. Otherwise, this TagSpec is not eligible for validation against this HTML tag.
        Parameters:
        dispatchKeyType - a DispatchKeyType.
        attrName - attribute name.
        attrValue - attribute value.
        mandatoryParent - may be set to "$NOPARENT"
        Returns:
        returns dispatch key.
      • getDispatchKeyForTagSpecOrNone

        public static String getDispatchKeyForTagSpecOrNone​(@Nonnull
                                                            dev.amp.validator.ValidatorProtos.TagSpec tagSpec)
        For a provided tag spec, generates its dispatch key.
        Parameters:
        tagSpec - a tag spec.
        Returns:
        a dispatch key.