public SpecificationPlugin(Configuration conf, String prop) { super(prop); _conf = conf; addListener(this); }
/** * Set a value from the given String after validating. * * @param str can be null to set the Specification to null. * If non-null, then the String must be in Specification format * @see Specification#create(String) */ @Override public void setString(String str) { this.set(str == null ? null : new Specification(str)); }
/** * Set a value from the given object after validating. * * @param obj can be null to set the Specification to null. */ @Override public void set(Object obj) { if (obj == null) { super.set(null); return; } if (obj instanceof Specification == false) { throw new UserException(_loc.get("spec-wrong-obj", obj, obj.getClass())).setFatal(true); } validateOverwrite((Specification)obj); super.set(obj); }
/** * 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. * * @exception fatal UserException if the given Specification is same as * the current Specification but has a higher major version. * * @see Specification#equals(Object) */ protected void validateOverwrite(Specification newSpec) { Specification current = (Specification)get(); if (current != null) { Log log = _conf.getConfigurationLog(); if (!current.isSame(newSpec)) { log.warn(_loc.get("spec-different", newSpec, current)); return; } if (current.compareVersion(newSpec) < 0) { throw new UserException(_loc.get("spec-version-higher", newSpec, current)).setFatal(true); } if (current.compareVersion(newSpec) > 0) { log.warn(_loc.get("spec-version-lower", newSpec, current)); } } }
specification = new SpecificationPlugin(this, "Specification"); addValue(specification); specification.setInstantiatingGetter("getSpecificationInstance");
/** * Set a value from the given object after validating. * * @param obj can be null to set the Specification to null. */ @Override public void set(Object obj) { if (obj == null) { super.set(null); return; } if (obj instanceof Specification == false) { throw new UserException(_loc.get("spec-wrong-obj", obj, obj.getClass())).setFatal(true); } validateOverwrite((Specification)obj); super.set(obj); }
/** * 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. * * @exception fatal UserException if the given Specification is same as * the current Specification but has a higher major version. * * @see Specification#equals(Object) */ protected void validateOverwrite(Specification newSpec) { Specification current = (Specification)get(); if (current != null) { Log log = _conf.getConfigurationLog(); if (!current.isSame(newSpec)) { log.warn(_loc.get("spec-different", newSpec, current)); return; } if (current.compareVersion(newSpec) < 0) { throw new UserException(_loc.get("spec-version-higher", newSpec, current)).setFatal(true); } if (current.compareVersion(newSpec) > 0) { log.warn(_loc.get("spec-version-lower", newSpec, current)); } } }
specification = new SpecificationPlugin(this, "Specification"); addValue(specification); specification.setInstantiatingGetter("getSpecificationInstance");
public SpecificationPlugin(Configuration conf, String prop) { super(prop); _conf = conf; addListener(this); }
/** * Set a value from the given String after validating. * * @param str can be null to set the Specification to null. * If non-null, then the String must be in Specification format * @see Specification#create(String) */ @Override public void setString(String str) { this.set(str == null ? null : new Specification(str)); }
/** * Set a value from the given object after validating. * * @param obj can be null to set the Specification to null. */ @Override public void set(Object obj) { if (obj == null) { super.set(null); return; } if (obj instanceof Specification == false) { throw new UserException(_loc.get("spec-wrong-obj", obj, obj.getClass())).setFatal(true); } validateOverwrite((Specification)obj); super.set(obj); }
/** * 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. * * @exception fatal UserException if the given Specification is same as * the current Specification but has a higher major version. * * @see Specification#equals(Object) */ protected void validateOverwrite(Specification newSpec) { Specification current = (Specification)get(); if (current != null) { Log log = _conf.getConfigurationLog(); if (!current.isSame(newSpec)) { log.warn(_loc.get("spec-different", newSpec, current)); return; } if (current.compareVersion(newSpec) < 0) { throw new UserException(_loc.get("spec-version-higher", newSpec, current)).setFatal(true); } if (current.compareVersion(newSpec) > 0) { log.warn(_loc.get("spec-version-lower", newSpec, current)); } } }
specification = new SpecificationPlugin(this, "Specification"); addValue(specification); specification.setInstantiatingGetter("getSpecificationInstance");
public SpecificationPlugin(Configuration conf, String prop) { super(prop); _conf = conf; addListener(this); }
/** * Set a value from the given String after validating. * * @param str can be null to set the Specification to null. * If non-null, then the String must be in Specification format * @see Specification#create(String) */ @Override public void setString(String str) { this.set(str == null ? null : new Specification(str)); }
/** * Set a value from the given object after validating. * * @param obj can be null to set the Specification to null. */ @Override public void set(Object obj) { if (obj == null) { super.set(null); return; } if (obj instanceof Specification == false) { throw new UserException(_loc.get("spec-wrong-obj", obj, obj.getClass())).setFatal(true); } validateOverwrite((Specification)obj); super.set(obj); }
/** * 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. * * @exception fatal UserException if the given Specification is same as * the current Specification but has a higher major version. * * @see Specification#equals(Object) */ protected void validateOverwrite(Specification newSpec) { Specification current = (Specification)get(); if (current != null) { Log log = _conf.getConfigurationLog(); if (!current.isSame(newSpec)) { log.warn(_loc.get("spec-different", newSpec, current)); return; } if (current.compareVersion(newSpec) < 0) { throw new UserException(_loc.get("spec-version-higher", newSpec, current)).setFatal(true); } if (current.compareVersion(newSpec) > 0) { log.warn(_loc.get("spec-version-lower", newSpec, current)); } } }
specification = new SpecificationPlugin(this, "Specification"); addValue(specification); specification.setInstantiatingGetter("getSpecificationInstance");
public SpecificationPlugin(Configuration conf, String prop) { super(prop); _conf = conf; addListener(this); }
/** * Set a value from the given String after validating. * * @param str can be null to set the Specification to null. * If non-null, then the String must be in Specification format * @see Specification#create(String) */ @Override public void setString(String str) { this.set(str == null ? null : new Specification(str)); }