Esempio n. 1
0
 @Override
 public void setPriority(RulePriority priority) {
   // Only override if different than current value, or if already overridden.
   if (priority != super.getPriority() || this.priority != null) {
     this.priority = priority;
     super.setPriority(priority);
   }
 }
Esempio n. 2
0
 @Override
 public void setLanguage(Language language) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(language, super.getLanguage()) || this.language != null) {
     this.language = language;
     super.setLanguage(language);
   }
 }
Esempio n. 3
0
 @Override
 public void setExternalInfoUrl(String externalInfoUrl) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(externalInfoUrl, super.getExternalInfoUrl()) || this.externalInfoUrl != null) {
     this.externalInfoUrl = externalInfoUrl;
     super.setExternalInfoUrl(externalInfoUrl);
   }
 }
Esempio n. 4
0
 @Override
 public void setDescription(String description) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(description, super.getDescription()) || this.description != null) {
     this.description = description;
     super.setDescription(description);
   }
 }
Esempio n. 5
0
 @Override
 public void setMessage(String message) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(message, super.getMessage()) || this.message != null) {
     this.message = message;
     super.setMessage(message);
   }
 }
Esempio n. 6
0
 @Override
 public void setName(String name) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(name, super.getName()) || this.name != null) {
     this.name = name;
     super.setName(name);
   }
 }
Esempio n. 7
0
 @Override
 public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion) {
   // Only override if different than current value, or if already overridden.
   if (!isSame(maximumLanguageVersion, super.getMaximumLanguageVersion())
       || this.maximumLanguageVersion != null) {
     this.maximumLanguageVersion = maximumLanguageVersion;
     super.setMaximumLanguageVersion(maximumLanguageVersion);
   }
 }
Esempio n. 8
0
 @Override
 public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value) {
   // Only override if different than current value.
   if (!isSame(super.getProperty(propertyDescriptor), value)) {
     if (propertyValues == null) {
       propertyValues = new HashMap<PropertyDescriptor<?>, Object>();
     }
     propertyValues.put(propertyDescriptor, value);
     super.setProperty(propertyDescriptor, value);
   }
 }
Esempio n. 9
0
 @Override
 public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
     throws IllegalArgumentException {
   // Define on the underlying Rule, where it is impossible to have two
   // property descriptors with the same name.  Therefore, there is no need
   // to check if the property is already overridden at this level.
   super.definePropertyDescriptor(propertyDescriptor);
   if (propertyDescriptors == null) {
     propertyDescriptors = new ArrayList<PropertyDescriptor<?>>();
   }
   propertyDescriptors.add(propertyDescriptor);
 }
Esempio n. 10
0
  @Override
  public void addExample(String example) {
    // TODO Meaningful override of examples is hard, because they are merely
    // a list of strings.  How does one indicate override of a particular
    // value?  Via index?  Rule.setExample(int, String)?  But the XML format
    // does not provide a means of overriding by index, not unless you took
    // the position in the XML file to indicate corresponding index to
    // override.  But that means you have to override starting from index 0.
    // This would be so much easier if examples had to have names, like
    // properties.

    // Only override if different than current values.
    if (!contains(super.getExamples(), example)) {
      if (examples == null) {
        examples = new ArrayList<String>(1);
      }
      // TODO Fix later. To keep example overrides from being unbounded, we're only going to keep
      // track of the last one.
      examples.clear();
      examples.add(example);
      super.addExample(example);
    }
  }