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

de.smartics.maven.plugin.buildmetadata.scm.LocallyModifiedInfo Maven / Gradle / Ivy

/*
 * Copyright 2006-2019 smartics, Kronseder & Reiner GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package de.smartics.maven.plugin.buildmetadata.scm;

/**
 * Stores the information about locally modified files.
 */
public final class LocallyModifiedInfo {
  // ********************************* Fields *********************************

  // --- constants ------------------------------------------------------------

  // --- members --------------------------------------------------------------

  /**
   * The flag that shows whether the files are modified (true) or
   * not (false).
   */
  private final boolean locallyModified;

  /**
   * The list of files that where reported to be modified. This includes all
   * files that are not in-sync with the trunk of the repository.
   */
  private final String files;

  // ****************************** Initializer *******************************

  // ****************************** Constructors ******************************

  /**
   * Default constructor.
   *
   * @param locallyModified the flag that shows whether the files are modified (
   *        true) or not (false).
   * @param files the list of files that where reported to be modified.
   */
  public LocallyModifiedInfo(final boolean locallyModified,
      final String files) {
    this.locallyModified = locallyModified;
    this.files = normalize(files);
  }

  // ****************************** Inner Classes *****************************

  // ********************************* Methods ********************************

  // --- init -----------------------------------------------------------------

  private String normalize(final String files) {
    if (files == null) {
      return null;
    }
    return files.replace('\\', '/');
  }

  // --- get&set --------------------------------------------------------------

  /**
   * Returns the flag that shows whether the files are modified (
   * true) or not (false).
   *
   * @return the flag that shows whether the files are modified (
   *         true) or not (false).
   */
  public boolean isLocallyModified() {
    return locallyModified;
  }

  /**
   * Returns the list of files that where reported to be modified. This includes
   * all files that are not in-sync with the trunk of the repository.
   *
   * @return the list of files that where reported to be modified.
   */
  public String getFiles() {
    return files;
  }

  // --- business -------------------------------------------------------------

  // --- object basics --------------------------------------------------------

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy