/**
   * Sets the property to be writable
   *
   * @param mode New Mode {@link PropertPattern#READ_WRITE READ_WRITE}, {@link
   *     PropertPattern#READ_ONLY READ_ONLY} or {@link PropertPattern#WRITE_ONLY WRITE_ONLY}
   * @throws SourceException If the modification of source code is impossible.
   */
  public void setMode(int mode) throws SourceException {
    if (getMode() == mode) return;

    switch (mode) {
      case READ_WRITE:
        if (getterMethod == null) generateGetterMethod();
        if (setterMethod == null) generateSetterMethod();
        if (indexedGetterMethod == null) generateIndexedGetterMethod();
        if (indexedSetterMethod == null) generateIndexedSetterMethod();
        break;
      case READ_ONLY:
        if (getterMethod == null) generateGetterMethod();
        if (indexedGetterMethod == null) generateIndexedGetterMethod();
        if (setterMethod != null) deleteSetterMethod();
        if (indexedSetterMethod != null) deleteIndexedSetterMethod();
        break;
      case WRITE_ONLY:
        if (setterMethod == null) generateSetterMethod();
        if (indexedSetterMethod == null) generateIndexedSetterMethod();
        if (getterMethod != null) deleteGetterMethod();
        if (indexedGetterMethod != null) deleteIndexedGetterMethod();
        break;
    }
  }
 /**
  * Destroys methods associated methods with the pattern in source
  *
  * @throws SourceException If modification of source is impossible
  */
 public void destroy() throws SourceException {
   deleteIndexedSetterMethod();
   deleteIndexedGetterMethod();
   super.destroy();
 }