本文整理汇总了Java中org.apache.tools.ant.PropertyHelper类的典型用法代码示例。如果您正苦于以下问题:Java PropertyHelper类的具体用法?Java PropertyHelper怎么用?Java PropertyHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyHelper类属于org.apache.tools.ant包,在下文中一共展示了PropertyHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
private Resource parse(final String line) {
PropertyHelper propertyHelper =
PropertyHelper.getPropertyHelper(getProject());
Object expanded = propertyHelper.parseProperties(line);
if (expanded instanceof Resource) {
return (Resource) expanded;
}
String expandedLine = expanded.toString();
int colon = expandedLine.indexOf(':');
if (colon >= 0) {
// could be an URL or an absolute file on an OS with drives
try {
return new URLResource(expandedLine);
} catch (BuildException mfe) {
// a translated MalformedURLException
// probably it's an absolute path fall back to file
// resource
}
}
return new FileResource(getProject(), expandedLine);
}
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:ResourceList.java
示例2: execute
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* See whether our nested condition holds and set the property.
*
* @since Ant 1.4
* @exception BuildException if an error occurs
*/
public void execute() throws BuildException {
if (countConditions() > 1) {
throw new BuildException(
"You must not nest more than one condition into <%s>",
getTaskName());
}
if (countConditions() < 1) {
throw new BuildException("You must nest a condition into <%s>",
getTaskName());
}
if (property == null) {
throw new BuildException("The property attribute is required.");
}
Condition c = getConditions().nextElement();
if (c.eval()) {
log("Condition true; setting " + property + " to " + value, Project.MSG_DEBUG);
PropertyHelper.getPropertyHelper(getProject()).setNewProperty(property, value);
} else if (alternative != null) {
log("Condition false; setting " + property + " to " + alternative, Project.MSG_DEBUG);
PropertyHelper.getPropertyHelper(getProject()).setNewProperty(property, alternative);
} else {
log("Condition false; not setting " + property, Project.MSG_DEBUG);
}
}
开发者ID:apache,项目名称:ant,代码行数:31,代码来源:ConditionTask.java
示例3: auditPropertyChange
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
public void auditPropertyChange(String property, Object value,
Project project) {
List audits = (List) propertyaudits.get(property);
if (audits != null) {
project.log("Adding Attempted Change record for Property: "
+ property, Project.MSG_DEBUG);
// if any target executes while currentTarget = null, it indicates
// the property
// transition happened outside the scope of any target, directly
// inside the build file
PropertyHelper helper = PropertyHelper.getPropertyHelper(project);
StringBuffer sb = new StringBuffer();
sb.append("Property [").append(property).append(
"] change attempted from [");
sb.append(helper.getProperty(property)).append("] to [");
sb.append(value).append("]");
String message = sb.toString();
audits.add(message);
// if there is a debugger attached to this instance, pass the
// control to the debugger
if (prompt != null)
prompt.prompt(message);
}
}
开发者ID:apache,项目名称:ant-easyant-tasks,代码行数:27,代码来源:DefaultAuditor.java
示例4: buildStarted
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
public void buildStarted(BuildEvent event) {
// set audit property helper that will help keep track of properties
// being set everywhere.
project = event.getProject();
PropertyHelper helper = new PropertyDebugHelper();
helper.setProject(project);
auditor = new DefaultAuditor();
((PropertyDebugHelper) helper).setAuditor(auditor);
// Is it better to set it as a project helper or as a delegate to the
// helper?
project.addReference(MagicNames.REFID_PROPERTY_HELPER, helper);
commandHandler.setProject(project);
commandHandler.init(getDefaultCommandSupport());
prompt = new DebugPrompt(project, commandHandler);
auditor.setPrompt(prompt);
// this is how the debugging starts
prompt.prompt("Type /? to get any help.");
}
开发者ID:apache,项目名称:ant-easyant-tasks,代码行数:20,代码来源:DebuggerListener.java
示例5: execute
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
@Override
public void execute() throws BuildException {
super.execute();
PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());
Object asserted = propertyHelper.getProperty("oborelease.asserted");
if(asserted != null && asserted.toString().equals("yes")){
addProperty("oborelease.asserted.option", "--asserted");
}else{
addProperty("oborelease.asserted.option", "");
}
Object simple = propertyHelper.getProperty("oborelease.simple");
if(simple != null && "yes".equals(simple.toString())){
addProperty("oborelease.simple.option", "--simple");
}else{
addProperty("oborelease.simple.option", "");
}
/*Object oboIncludes = propertyHelper.getProperty("oborelease.oboincludes");
if(oboIncludes != null && oboIncludes.toString().trim().length()>0){
addProperty("oborelease.oboincludes.option", "-oboincludes " + oboIncludes);
}else{
addProperty("oborelease.oboincludes.option", "" + oboIncludes);
}*/
}
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:OboProperty.java
示例6: evaluate
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Evaluate a property.
* @param property the property's String "identifier".
* @param helper the invoking PropertyHelper.
* @return Object value.
*/
public Object evaluate(String property, PropertyHelper helper) {
synchronized (LOCK) {
for (Map<String, Object> map : stack) {
Object ret = map.get(property);
if (ret != null) {
return ret;
}
}
}
return null;
}
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:LocalPropertyStack.java
示例7: setNew
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Set a *new" property.
* @param property the property's String "identifier".
* @param value the value to set.
* @param propertyHelper the invoking PropertyHelper.
* @return true if this entity 'owns' the property.
*/
public boolean setNew(
String property, Object value, PropertyHelper propertyHelper) {
Map<String, Object> map = getMapForProperty(property);
if (map == null) {
return false;
}
Object currValue = map.get(property);
if (currValue == NullReturn.NULL) {
map.put(property, value);
}
return true;
}
开发者ID:apache,项目名称:ant,代码行数:20,代码来源:LocalPropertyStack.java
示例8: set
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Set a property.
* @param property the property's String "identifier".
* @param value the value to set.
* @param propertyHelper the invoking PropertyHelper.
* @return true if this entity 'owns' the property.
*/
public boolean set(String property, Object value, PropertyHelper propertyHelper) {
Map<String, Object> map = getMapForProperty(property);
if (map == null) {
return false;
}
map.put(property, value);
return true;
}
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:LocalPropertyStack.java
示例9: get
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Get a localproperties for the given project.
* @param project the project to retrieve the localproperties for.
* @return the localproperties.
*/
public static synchronized LocalProperties get(Project project) {
LocalProperties l =
project.getReference(MagicNames.REFID_LOCAL_PROPERTIES);
if (l == null) {
l = new LocalProperties();
project.addReference(MagicNames.REFID_LOCAL_PROPERTIES, l);
PropertyHelper.getPropertyHelper(project).add(l);
}
return l;
}
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:LocalProperties.java
示例10: getObjectValue
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Get the Object value of this PropertyResource.
* @return the Object value of the specified Property.
* @since Ant 1.8.1
*/
public Object getObjectValue() {
if (isReference()) {
return getCheckedRef().getObjectValue();
}
Project p = getProject();
return p == null ? null : PropertyHelper.getProperty(p, getName());
}
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:PropertyResource.java
示例11: addConfigured
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Add a new PropertyHelper to be set on the Project.
* @param propertyHelper the PropertyHelper to set.
*/
public synchronized void addConfigured(PropertyHelper propertyHelper) {
if (this.propertyHelper != null) {
throw new BuildException("Only one PropertyHelper can be installed");
}
this.propertyHelper = propertyHelper;
}
开发者ID:apache,项目名称:ant,代码行数:11,代码来源:PropertyHelperTask.java
示例12: execute
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Execute the task.
* @throws BuildException on error.
*/
@Override
public void execute() throws BuildException {
if (getProject() == null) {
throw new BuildException("Project instance not set");
}
if (propertyHelper == null && delegates == null) {
throw new BuildException(
"Either a new PropertyHelper or one or more PropertyHelper delegates are required");
}
PropertyHelper ph = propertyHelper;
if (ph == null) {
ph = PropertyHelper.getPropertyHelper(getProject());
} else {
ph = propertyHelper;
}
synchronized (ph) {
if (delegates != null) {
for (Object o : delegates) {
PropertyHelper.Delegate delegate = o instanceof DelegateElement
? ((DelegateElement) o).resolve() : (PropertyHelper.Delegate) o;
log("Adding PropertyHelper delegate " + delegate, Project.MSG_DEBUG);
ph.add(delegate);
}
}
}
if (propertyHelper != null) {
log("Installing PropertyHelper " + propertyHelper, Project.MSG_DEBUG);
// TODO copy existing properties to new PH?
getProject().addReference(MagicNames.REFID_PROPERTY_HELPER, propertyHelper);
}
}
开发者ID:apache,项目名称:ant,代码行数:36,代码来源:PropertyHelperTask.java
示例13: execute
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Entry point when operating as a task.
*
* @exception BuildException if the task is not configured correctly.
*/
@Override
public void execute() throws BuildException {
if (property == null) {
throw new BuildException("property attribute is required",
getLocation());
}
isTask = true;
try {
if (eval()) {
PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
Object oldvalue = ph.getProperty(property);
if (null != oldvalue && !oldvalue.equals(value)) {
log("DEPRECATED - <available> used to override an existing"
+ " property."
+ StringUtils.LINE_SEP
+ " Build file should not reuse the same property"
+ " name for different values.",
Project.MSG_WARN);
}
// NB: this makes use of Project#setProperty rather than Project#setNewProperty
// due to backwards compatibility reasons
ph.setProperty(property, value, true);
}
} finally {
isTask = false;
}
}
开发者ID:apache,项目名称:ant,代码行数:34,代码来源:Available.java
示例14: addProperty
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* add a name value pair to the project property set
* @param n name of property
* @param v value to set
* @since Ant 1.8
*/
protected void addProperty(String n, Object v) {
PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
if (userProperty) {
if (ph.getUserProperty(n) == null) {
ph.setInheritedProperty(n, v);
} else {
log("Override ignored for " + n, Project.MSG_VERBOSE);
}
} else {
ph.setNewProperty(n, v);
}
}
开发者ID:apache,项目名称:ant,代码行数:19,代码来源:Property.java
示例15: resolveAllProperties
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* resolve properties inside a properties hashtable
* @param props properties object to resolve
*/
private void resolveAllProperties(Map<String, Object> props) throws BuildException {
PropertyHelper propertyHelper
= PropertyHelper.getPropertyHelper(getProject());
new ResolvePropertyMap(
getProject(),
propertyHelper,
propertyHelper.getExpanders())
.resolveAllProperties(props, getPrefix(), getPrefixValues());
}
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:Property.java
示例16: read
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* Returns the next character in the filtered stream. The original
* stream is first read in fully, and the Ant properties are expanded.
* The results of this expansion are then queued so they can be read
* character-by-character.
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
* @exception IOException if the underlying stream throws an IOException
* during reading
*/
public int read() throws IOException {
if (index > EOF) {
if (buffer == null) {
String data = readFully();
Project project = getProject();
GetProperty getProperty;
if (propertySet == null) {
getProperty = PropertyHelper.getPropertyHelper(project);
} else {
final Properties props = propertySet.getProperties();
getProperty = new GetProperty() {
public Object getProperty(String name) {
return props.getProperty(name);
}
};
}
Object expanded = new ParseProperties(project, PropertyHelper
.getPropertyHelper(project)
.getExpanders(),
getProperty)
.parseProperties(data);
buffer = expanded == null ? new char[0]
: expanded.toString().toCharArray();
}
if (index < buffer.length) {
return buffer[index++];
}
index = EOF;
}
return EOF;
}
开发者ID:apache,项目名称:ant,代码行数:45,代码来源:ExpandProperties.java
示例17: execute
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
/**
* perform the actual ant task
* @throws BuildException
*/
@Override
public void execute() throws BuildException {
try {
Node root = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new FileInputStream(manifest)).getDocumentElement();
for (Node activity : getNodesWithName(getNodeWithName(root, "application"), "activity", true)) {
Node intent_filter = getNodeWithName(activity, "intent-filter");
Node action = getNodeWithName(intent_filter, "action");
Node category = getNodeWithName(intent_filter, "category");
if (action != null && category != null) {
String packg = getAttribute(root, "package");
String name = getAttribute(activity, "android:name");
String acname = getAttribute(action, "android:name");
String catname = getAttribute(category, "android:name");
if (packg != null && name != null && acname != null && catname != null && acname.equalsIgnoreCase("android.intent.action.MAIN")
&& catname.equalsIgnoreCase("android.intent.category.LAUNCHER")) {
PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
ph.setProperty(null, "xmlvm.android.package", (Object) packg, false);
ph.setProperty(null, "xmlvm.android.packagedir", (Object) packg.replace('.', File.separatorChar), false);
ph.setProperty(null, "xmlvm.android.activity", (Object) name, false);
return;
}
}
}
} catch (Exception ex) {
if (ex instanceof BuildException) {
throw (BuildException) ex;
} else {
throw new BuildException(ex);
}
}
throw new BuildException("Unable to find main activity");
}
开发者ID:shannah,项目名称:cn1,代码行数:38,代码来源:AndroidManifestParser.java
示例18: AntRunner
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
public AntRunner(IResourceService resourceService, FileObject antFile, FileObject baseDir,
Map<String, String> properties, @SuppressWarnings("unused") @Nullable URL[] classpaths,
@Nullable BuildListener listener) {
this.antProject = new Project();
final File localAntFile = resourceService.localFile(antFile);
final File localBaseDir = resourceService.localPath(baseDir);
// TODO: use classpaths
antProject.setProperty(MagicNames.ANT_FILE, localAntFile.getPath());
antProject.setBaseDir(localBaseDir);
antProject.init();
if(listener != null) {
antProject.addBuildListener(listener);
}
final PropertyHelper propHelper = PropertyHelper.getPropertyHelper(antProject);
antProject.addReference(MagicNames.REFID_PROPERTY_HELPER, propHelper);
for(Entry<String, String> property : properties.entrySet()) {
propHelper.setUserProperty(property.getKey(), property.getValue());
}
final ProjectHelper projectHelper = ProjectHelper.getProjectHelper();
antProject.addReference(MagicNames.REFID_PROJECT_HELPER, projectHelper);
projectHelper.parse(antProject, localAntFile);
}
开发者ID:metaborg,项目名称:spoofax,代码行数:28,代码来源:AntRunner.java
示例19: doSetProperty
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void doSetProperty(String property, Object newValue) {
PropertyHelper.getPropertyHelper(getProject()).setUserProperty(null, property, newValue);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DefaultAntBuilder.java
示例20: addProperty
import org.apache.tools.ant.PropertyHelper; //导入依赖的package包/类
private void addProperty(String n, Object v) {
PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
ph.setNewProperty(n, v);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:5,代码来源:GetOntologyId.java
注:本文中的org.apache.tools.ant.PropertyHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论