All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.devonfw.tools.ide.migrator.line.AbstractLineMigration Maven / Gradle / Ivy

Go to download

Code for configurator the creates or updates configuration of IDEs (Eclipse, etc.).

There is a newer version: 3.0.0-beta25
Show newest version
package com.devonfw.tools.ide.migrator.line;

import java.io.File;
import java.io.FileFilter;

/**
 * Abstract base implementation of {@link LineMigration}.
 */
public abstract class AbstractLineMigration implements LineMigration {

  private final FileFilter fileFilter;

  private boolean disabled;

  /**
   * The constructor.
   *
   * @param fileFilter the {@link FileFilter} to accept the files that shall be migrated.
   */
  public AbstractLineMigration(FileFilter fileFilter) {

    super();
    this.fileFilter = fileFilter;
  }

  @Override
  public void init(File file) {

    this.disabled = !this.fileFilter.accept(file);
  }

  @Override
  public final String migrateLine(String line) {

    if (this.disabled) {
      return line;
    }
    return migrate(line);
  }

  /**
   * @see #migrateLine(String)
   * @param line the line to migrate.
   * @return the migrated line.
   */
  protected abstract String migrate(String line);

  @Override
  public void clear() {

    this.disabled = false;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy