Path: blob/master/sourcetools/com.ibm.jpp.preprocessor/com/ibm/jpp/om/Src.java
6004 views
/*******************************************************************************1* Copyright (c) 1999, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/21package com.ibm.jpp.om;2223import java.io.File;24import java.util.Properties;2526/**27* Src represents a preprocessor source folder and it's associated options (such as the jxelink28* or msg output directories).29*/30public class Src {31private final File srcFolder;32private final Properties options;33private final boolean isSimple;34private final String srcPath;35private final String simpleCopyOutput;3637/**38* Class constructor.39*40* @param folderString the source directory41* @param isSimple <code>true</code> if this is a simple copy source42*/43public Src(String folderString, boolean isSimple) {44this.srcFolder = new File(folderString);45this.options = new Properties();46this.isSimple = isSimple;47this.srcPath = folderString;48this.simpleCopyOutput = "";49}5051/**52* Class constructor.53*54* @param folderString the source directory55* @param simpleCopyOutput the simple copy output path56*/57public Src(String folderString, String simpleCopyOutput) {58this.srcFolder = new File(folderString);59this.options = new Properties();60this.isSimple = true;61this.srcPath = folderString;62this.simpleCopyOutput = simpleCopyOutput;63}6465/**66* Class constructor.67*68* @param folderString the source directory69*/70public Src(String folderString) {71this.srcFolder = new File(folderString);72this.options = new Properties();73this.isSimple = false;74this.srcPath = folderString;75this.simpleCopyOutput = "";76}7778/**79* Returns this source's relative folder.80*81* @return the relative folder82*/83public File getRelativeSrcFolder() {84return srcFolder;85}8687/**88* Returns this source's relative path.89*90* @return the relative path91*/92public String getRelativeSrcPath() {93return srcPath;94}9596/**97* Returns this source's simplecopy output.98*99* @return the simplecopy output100*/101public String getSimpleCopyOutput() {102return simpleCopyOutput;103}104105/**106* Adds an option to this source.107*108* @param name the option name109* @param value the option value110*/111public void addOption(String name, String value) {112options.setProperty(name, value);113}114115/**116* Returns the options associated with this source.117*118* @return the source options119*/120public Properties getOptions() {121return options;122}123124/**125* Returns whether this source is a simple copy source.126*127* @return <code>true</code> if the source is simple copy, <code>false</code> otherwise128*/129public boolean isSimpleCopy() {130return isSimple;131}132133/**134* @see java.lang.Object#toString()135*/136@Override137public String toString() {138return srcFolder.toString() + " " + options.toString();139}140}141142143