1 /* 2 * #%L 3 * Native ARchive plugin for Maven 4 * %% 5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers. 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 package com.github.maven_nar.cpptasks; 21 22 /******************************************************************************* 23 * Place class description here. 24 * 25 * @author inger 26 * @author <additional author> 27 * 28 * @since 29 ******************************************************************************/ 30 public class ProcessorParam { 31 private String ifCond; 32 private String name; 33 private String unlessCond; 34 private String value; 35 36 public ProcessorParam() { 37 } 38 39 public String getName() { 40 return this.name; 41 } 42 43 public String getValue() { 44 return this.value; 45 } 46 47 /** 48 * Returns true if the define's if and unless conditions (if any) are 49 * satisfied. 50 */ 51 public boolean isActive(final org.apache.tools.ant.Project p) { 52 if (this.value == null) { 53 return false; 54 } 55 if (this.ifCond != null && p.getProperty(this.ifCond) == null) { 56 return false; 57 } else if (this.unlessCond != null && p.getProperty(this.unlessCond) != null) { 58 return false; 59 } 60 return true; 61 } 62 63 /** 64 * Sets the property name for the 'if' condition. 65 * 66 * The argument will be ignored unless the property is defined. 67 * 68 * The value of the property is insignificant, but values that would imply 69 * misinterpretation ("false", "no") will throw an exception when 70 * evaluated. 71 */ 72 public void setIf(final String propName) { 73 this.ifCond = propName; 74 } 75 76 /** 77 * Specifies relative location of argument on command line. "start" will 78 * place argument at start of command line, "mid" will place argument after 79 * all "start" arguments but before filenames, "end" will place argument 80 * after filenames. 81 * 82 */ 83 public void setName(final String name) { 84 this.name = name; 85 } 86 87 /** 88 * Set the property name for the 'unless' condition. 89 * 90 * If named property is set, the argument will be ignored. 91 * 92 * The value of the property is insignificant, but values that would imply 93 * misinterpretation ("false", "no") of the behavior will throw an 94 * exception when evaluated. 95 * 96 * @param propName 97 * name of property 98 */ 99 public void setUnless(final String propName) { 100 this.unlessCond = propName; 101 } 102 103 /** 104 * Specifies the string that should appear on the command line. The 105 * argument will be quoted if it contains embedded blanks. Use multiple 106 * arguments to avoid quoting. 107 * 108 */ 109 public void setValue(final String value) { 110 this.value = value; 111 } 112 }