本文整理了Java中org.apache.tools.ant.Project.toBoolean()
方法的一些代码示例,展示了Project.toBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.toBoolean()
方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:toBoolean
[英]Return the boolean equivalent of a string, which is considered true
if either "on"
, "true"
, or "yes"
is found, ignoring case.
[中]返回字符串的布尔等价物,如果找到"on"
、"true"
或"yes"
中的任何一个,则将其视为true
,忽略大小写。
代码示例来源:origin: org.apache.ant/ant
/**
* The filtering attribute.
* Default is false.
* @param filter if true use filtering
*/
public void setFiltering(String filter) {
filtering = Project.toBoolean(filter);
}
代码示例来源:origin: org.apache.ant/ant
/**
* Sets whether an existing file should be replaced.
* @param replace <code>on</code>, if an existing file should be replaced.
*/
public void setReplace(String replace) {
this.replace = Project.toBoolean(replace);
}
代码示例来源:origin: org.apache.ant/ant
@Override
public void set(final Project p, final Object parent, final String value)
throws InvocationTargetException, IllegalAccessException {
m.invoke(parent, (Object[]) new Boolean[] {
Project.toBoolean(value) ? Boolean.TRUE : Boolean.FALSE });
}
};
代码示例来源:origin: org.apache.ant/ant
/**
* Give the copied files the same last modified time as the original files.
* @param preserve a boolean string.
* @deprecated since 1.5.x.
* setPreserveLastModified(String) has been deprecated and
* replaced with setPreserveLastModified(boolean) to
* consistently let the Introspection mechanism work.
*/
@Deprecated
public void setPreserveLastModified(final String preserve) {
setPreserveLastModified(Project.toBoolean(preserve));
}
代码示例来源:origin: org.apache.ant/ant
/**
* check if the attribute value is true or not
* {@inheritDoc}
*/
public boolean isEnabled(UnknownElement el, String value) {
return convertResult(Project.toBoolean(value));
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* If the given object can be interpreted as a true/false value,
* turn it into a matching Boolean - otherwise return null.
* @param value Object
* @return Boolean
* @since Ant 1.8.0
*/
public static Boolean toBoolean(Object value) {
if (value instanceof Boolean) {
return (Boolean) value;
}
if (value instanceof String) {
String s = (String) value;
if (Project.toBoolean(s)) {
return Boolean.TRUE;
}
if ("off".equalsIgnoreCase(s)
|| "false".equalsIgnoreCase(s)
|| "no".equalsIgnoreCase(s)) {
return Boolean.FALSE;
}
}
return null;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Set a feature
* @return true if the feature could be set
*/
public boolean evalFeature() {
XMLReader reader = getReader();
if (value == null) {
value = "true";
}
boolean v = Project.toBoolean(value);
try {
reader.setFeature(feature, v);
} catch (SAXNotRecognizedException e) {
log(FEATURE + NOT_RECOGNIZED + feature, Project.MSG_VERBOSE);
return false;
} catch (SAXNotSupportedException e) {
log(FEATURE + NOT_SUPPORTED + feature, Project.MSG_VERBOSE);
return false;
}
return true;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Parses the parameters to add user-defined contains strings.
*/
private void initialize() {
Parameter[] params = getParameters();
if (params != null) {
for (Parameter param : params) {
if (CONTAINS_KEY.equals(param.getType())) {
contains.addElement(param.getValue());
} else if (NEGATE_KEY.equals(param.getType())) {
setNegate(Project.toBoolean(param.getValue()));
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* When using this as a custom selector, this method will be called.
* It translates each parameter into the appropriate setXXX() call.
*
* @param parameters the complete set of parameters for this selector
*/
public void setParameters(Parameter... parameters) {
super.setParameters(parameters);
if (parameters != null) {
for (Parameter parameter : parameters) {
String paramname = parameter.getName();
if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) {
setExpression(parameter.getValue());
} else if (CS_KEY.equalsIgnoreCase(paramname)) {
setCaseSensitive(Project.toBoolean(parameter.getValue()));
} else if (ML_KEY.equalsIgnoreCase(paramname)) {
setMultiLine(Project.toBoolean(parameter.getValue()));
} else if (SL_KEY.equalsIgnoreCase(paramname)) {
setSingleLine(Project.toBoolean(parameter.getValue()));
} else {
setError("Invalid parameter " + paramname);
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Parses parameters to add user defined regular expressions.
*/
private void initialize() {
Parameter[] params = getParameters();
if (params != null) {
for (Parameter param : params) {
if (REGEXP_KEY.equals(param.getType())) {
setRegexp(param.getValue());
} else if (NEGATE_KEY.equals(param.getType())) {
setNegate(Project.toBoolean(param.getValue()));
} else if (CS_KEY.equals(param.getType())) {
setCaseSensitive(Project.toBoolean(param.getValue()));
}
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* turn proxies on;
* if the proxy key is already set to some value: leave alone.
* if an ant property of the value {@link #USE_SYSTEM_PROXIES}
* is set, use that instead. Else set to "true".
*/
public void enableProxies() {
if (getSystemProxySetting() == null) {
String proxies = owner.getProperty(USE_SYSTEM_PROXIES);
if (proxies == null || Project.toBoolean(proxies)) {
proxies = "true";
}
String message = "setting " + USE_SYSTEM_PROXIES + " to " + proxies;
try {
owner.log(message, Project.MSG_DEBUG);
System.setProperty(USE_SYSTEM_PROXIES, proxies);
} catch (SecurityException e) {
//log security exceptions and continue; it aint that
//important and may be quite common running Ant embedded.
owner.log("Security Exception when " + message);
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* When using this as a custom selector, this method will be called.
* It translates each parameter into the appropriate setXXX() call.
*
* @param parameters the complete set of parameters for this selector
*/
public void setParameters(Parameter... parameters) {
super.setParameters(parameters);
if (parameters != null) {
for (Parameter parameter : parameters) {
String paramname = parameter.getName();
if (CONTAINS_KEY.equalsIgnoreCase(paramname)) {
setText(parameter.getValue());
} else if (CASE_KEY.equalsIgnoreCase(paramname)) {
setCasesensitive(Project.toBoolean(
parameter.getValue()));
} else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) {
setIgnorewhitespace(Project.toBoolean(
parameter.getValue()));
} else {
setError("Invalid parameter " + paramname);
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* When using this as a custom selector, this method will be called.
* It translates each parameter into the appropriate setXXX() call.
*
* @param parameters the complete set of parameters for this selector
*/
public void setParameters(Parameter... parameters) {
super.setParameters(parameters);
if (parameters != null) {
for (Parameter parameter : parameters) {
String paramname = parameter.getName();
if (NAME_KEY.equalsIgnoreCase(paramname)) {
setName(parameter.getValue());
} else if (CASE_KEY.equalsIgnoreCase(paramname)) {
setCasesensitive(Project.toBoolean(
parameter.getValue()));
} else if (NEGATE_KEY.equalsIgnoreCase(paramname)) {
setNegate(Project.toBoolean(parameter.getValue()));
} else if (REGEX_KEY.equalsIgnoreCase(paramname)) {
setRegex(parameter.getValue());
} else {
setError("Invalid parameter " + paramname);
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
if (emacsProperty != null && Project.toBoolean(emacsProperty)) {
cmd.createArgument().setValue("+E");
Project.MSG_WARN);
attributes.log("!! Use the nowarn attribute instead. !!", Project.MSG_WARN);
if (!Project.toBoolean(warningsProperty)) {
cmd.createArgument().setValue("-nowarn");
if (pedanticProperty != null && Project.toBoolean(pedanticProperty)) {
cmd.createArgument().setValue("+P");
&& Project.toBoolean(fullDependProperty)) {
cmd.createArgument().setValue("+F");
代码示例来源:origin: org.apache.ant/ant
setDatetime(parameter.getValue());
} else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) {
setCheckdirs(Project.toBoolean(parameter.getValue()));
} else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) {
try {
代码示例来源:origin: org.apache.ant/ant
boolean notify = Project.toBoolean(getValue(properties,
prefix + ".notify", "on"));
.user(getValue(properties, "user", ""))
.password(getValue(properties, "password", ""))
.ssl(Project.toBoolean(getValue(properties,
"ssl", "off")))
.starttls(Project.toBoolean(getValue(properties,
"starttls.enable", "off")))
.from(getValue(properties, "from", null))
代码示例来源:origin: org.apache.ant/ant
String mse = getProject().getProperty("build.compiler.jvc.extensions");
if (mse != null) {
msExtensions = Project.toBoolean(mse);
代码示例来源:origin: siom79/japicmp
public void setReportOnlyFilename(String reportOnlyFilename) {
this.reportOnlyFilename = Project.toBoolean(reportOnlyFilename);
}
代码示例来源:origin: siom79/japicmp
public void setIgnoreMissingClasses(String ignoreMissingClasses) {
this.ignoreMissingClasses = Project.toBoolean(ignoreMissingClasses);
}
代码示例来源:origin: org.apache.ant/ant-junit
/**
* Whether test listener events shall be generated.
*
* @return boolean
* @since Ant 1.8.2
*/
public boolean getEnableTestListenerEvents() {
final String e = getProject().getProperty(ENABLE_TESTLISTENER_EVENTS);
if (e != null) {
return Project.toBoolean(e);
}
return enableTestListenerEvents;
}
内容来源于网络,如有侵权,请联系作者删除!