Class SpecificationPlugin

  • All Implemented Interfaces:
    java.lang.Cloneable, ValueListener

    public class SpecificationPlugin
    extends ObjectValue
    implements ValueListener
    A plug-in for Specification that enforces certain overwriting rules.
    Author:
    Pinaki Poddar
    • Field Detail

      • _loc

        protected static final Localizer _loc
    • Constructor Detail

      • SpecificationPlugin

        public SpecificationPlugin​(Configuration conf,
                                   java.lang.String prop)
    • Method Detail

      • getValueType

        public java.lang.Class<?> getValueType()
        Description copied from class: Value
        Returns the type of the property that this Value represents.
        Overrides:
        getValueType in class ObjectValue
      • setString

        public void setString​(java.lang.String str)
        Set a value from the given String after validating.
        Overrides:
        setString in class Value
        Parameters:
        str - can be null to set the Specification to null. If non-null, then the String must be in Specification format
        See Also:
        Specification#create(String)
      • set

        public void set​(java.lang.Object obj)
        Set a value from the given object after validating.
        Overrides:
        set in class ObjectValue
        Parameters:
        obj - can be null to set the Specification to null.
      • validateOverwrite

        protected void validateOverwrite​(Specification newSpec)
        Validates if the given Specification can overwrite the current Specification. If the given Specification is not same as the current one, then it is valid to overwrite. If the given Specification is same as the current Specification then it must have a major version number equal or less than the current one.
        Throws:
        fatal - UserException if the given Specification is same as the current Specification but has a higher major version.
        See Also:
        Specification.equals(Object)