package org.opengroupware.jope.eocontrol;

import org.opengroupware.jope.foundation.NSObject;

/*
 * EOQualifierVariable
 * 
 * Used to define dynamic fields in a qualifier. Those can be resolved by
 * calling qualifierWithBindings() on an EOQualifier hierarchy.
 * 
 * Syntax:
 *   $variable
 *   lastname = $lastname
 */
public class EOQualifierVariable extends NSObject {

  protected String key;
  
  public EOQualifierVariable(String _key) {
    this.key = _key;
  }
  
  /* accessors */
  
  public String key() {
    return this.key;
  }
  
  /* equals */
  
  public boolean equals(Object _other) {
    if (this   == _other) return true;
    if (_other == null) return false;
    if (!(_other instanceof EOQualifierVariable)) return false;
    return this.key.equals(((EOQualifierVariable)_other).key());
  }
  
  /* description */
  
  public void appendAttributesToDescription(StringBuffer _d) {
    _d.append(" key=" + this.key);
  }
}
