Java Doc for Property.java in  » Build » ANT » org » apache » tools » ant » taskdefs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.tools.ant.Task
   org.apache.tools.ant.taskdefs.Property

Property
public class Property extends Task (Code)
Sets a property by name, or set of properties (from file or resource) in the project.

Properties are immutable: whoever sets a property first freezes it for the rest of the build; they are most definitely not variable.

There are five ways to set properties:

  • By supplying both the name and value attribute.
  • By supplying both the name and refid attribute.
  • By setting the file attribute with the filename of the property file to load. This property file has the format as defined by the file used in the class java.util.Properties.
  • By setting the resource attribute with the resource name of the property file to load. This property file has the format as defined by the file used in the class java.util.Properties.
  • By setting the environment attribute with a prefix to use. Properties will be defined for every environment variable by prefixing the supplied name and a period to the name of the variable.

Although combinations of these ways are possible, only one should be used at a time. Problems might occur with the order in which properties are set, for instance.

The value part of the properties being set, might contain references to other properties. These references are resolved at the time these properties are set. This also holds for properties loaded from a property file.

Properties are case sensitive.
since:
   Ant 1.1


Field Summary
protected  Pathclasspath
    
protected  Stringenv
    
protected  Filefile
    
protected  Stringname
    
protected  Stringprefix
    
protected  Referenceref
    
protected  Stringresource
    
protected  URLurl
    
protected  booleanuserProperty
    
protected  Stringvalue
    

Constructor Summary
public  Property()
     Constructor for Property.
protected  Property(boolean userProperty)
     Constructor for Property.
protected  Property(boolean userProperty, Project fallback)
     Constructor for Property.

Method Summary
protected  voidaddProperties(Properties props)
    
protected  voidaddProperty(String n, String v)
    
public  PathcreateClasspath()
     The classpath to use when looking up a resource.
public  voidexecute()
     set the property in the project to the value.
public  PathgetClasspath()
     Get the classpath used when looking up a resource.
public  StringgetEnvironment()
     Get the environment attribute.
public  FilegetFile()
     Get the file attribute.
public  StringgetName()
     Get the property name.
public  StringgetPrefix()
     Get the prefix attribute.
public  ReferencegetRefid()
     Get the refid attribute.
public  StringgetResource()
     Get the resource attribute.
public  URLgetUrl()
     Get the url attribute.
public  StringgetValue()
     Get the property value.
protected  voidloadEnvironment(String prefix)
    
protected  voidloadFile(File file)
    
protected  voidloadResource(String name)
    
protected  voidloadUrl(URL url)
    
public  voidsetClasspath(Path classpath)
     The classpath to use when looking up a resource.
public  voidsetClasspathRef(Reference r)
    
public  voidsetEnvironment(String env)
     Prefix to use when retrieving environment variables. Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

Note that if you supply a property name with a final "." it will not be doubled.

public  voidsetFile(File file)
     Filename of a property file to load.
public  voidsetLocation(File location)
     Sets the property to the absolute filename of the given file.
public  voidsetName(String name)
     The name of the property to set.
public  voidsetPrefix(String prefix)
     Prefix to apply to properties loaded using file or resource.
public  voidsetRefid(Reference ref)
     Sets a reference to an Ant datatype declared elsewhere.
public  voidsetResource(String resource)
    
public  voidsetUrl(URL url)
     The url from which to load properties.
public  voidsetUserProperty(boolean userProperty)
    
public  voidsetValue(String value)
     The value of the property.
public  StringtoString()
    

Field Detail
classpath
protected Path classpath(Code)



env
protected String env(Code)



file
protected File file(Code)



name
protected String name(Code)



prefix
protected String prefix(Code)



ref
protected Reference ref(Code)



resource
protected String resource(Code)



url
protected URL url(Code)



userProperty
protected boolean userProperty(Code)



value
protected String value(Code)




Constructor Detail
Property
public Property()(Code)
Constructor for Property.



Property
protected Property(boolean userProperty)(Code)
Constructor for Property.
Parameters:
  userProperty - if true this is a user property
since:
   Ant 1.5



Property
protected Property(boolean userProperty, Project fallback)(Code)
Constructor for Property.
Parameters:
  userProperty - if true this is a user property
Parameters:
  fallback - a project to use to look for references if the reference isnot in the current project
since:
   Ant 1.5




Method Detail
addProperties
protected void addProperties(Properties props)(Code)
iterate through a set of properties, resolve them then assign them
Parameters:
  props - the properties to iterate over



addProperty
protected void addProperty(String n, String v)(Code)
add a name value pair to the project property set
Parameters:
  n - name of property
Parameters:
  v - value to set



createClasspath
public Path createClasspath()(Code)
The classpath to use when looking up a resource. a path to be configured



execute
public void execute() throws BuildException(Code)
set the property in the project to the value. if the task was give a file, resource or env attribute here is where it is loaded
throws:
  BuildException - on error



getClasspath
public Path getClasspath()(Code)
Get the classpath used when looking up a resource. the classpath
since:
   Ant 1.5



getEnvironment
public String getEnvironment()(Code)
Get the environment attribute. the environment attribute
since:
   Ant 1.5



getFile
public File getFile()(Code)
Get the file attribute. the file attribute



getName
public String getName()(Code)
Get the property name. the property name



getPrefix
public String getPrefix()(Code)
Get the prefix attribute. the prefix attribute
since:
   Ant 1.5



getRefid
public Reference getRefid()(Code)
Get the refid attribute. the refid attribute



getResource
public String getResource()(Code)
Get the resource attribute. the resource attribute



getUrl
public URL getUrl()(Code)
Get the url attribute. the url attribute



getValue
public String getValue()(Code)
Get the property value. the property value



loadEnvironment
protected void loadEnvironment(String prefix)(Code)
load the environment values
Parameters:
  prefix - prefix to place before them



loadFile
protected void loadFile(File file) throws BuildException(Code)
load properties from a file
Parameters:
  file - file to load
throws:
  BuildException - on error



loadResource
protected void loadResource(String name)(Code)
load properties from a resource in the current classpath
Parameters:
  name - name of resource to load



loadUrl
protected void loadUrl(URL url) throws BuildException(Code)
load properties from a url
Parameters:
  url - url to load from
throws:
  BuildException - on error



setClasspath
public void setClasspath(Path classpath)(Code)
The classpath to use when looking up a resource.
Parameters:
  classpath - to add to any existing classpath



setClasspathRef
public void setClasspathRef(Reference r)(Code)
the classpath to use when looking up a resource, given as reference to a <path> defined elsewhere
Parameters:
  r - a reference to a classpath



setEnvironment
public void setEnvironment(String env)(Code)
Prefix to use when retrieving environment variables. Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;).
Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.
Parameters:
  env - prefix




setFile
public void setFile(File file)(Code)
Filename of a property file to load.
Parameters:
  file - filename



setLocation
public void setLocation(File location)(Code)
Sets the property to the absolute filename of the given file. If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions). Otherwise it is taken as a path relative to the project's basedir and expanded.
Parameters:
  location - path to set



setName
public void setName(String name)(Code)
The name of the property to set.
Parameters:
  name - property name



setPrefix
public void setPrefix(String prefix)(Code)
Prefix to apply to properties loaded using file or resource. A "." is appended to the prefix if not specified.
Parameters:
  prefix - prefix string
since:
   Ant 1.5



setRefid
public void setRefid(Reference ref)(Code)
Sets a reference to an Ant datatype declared elsewhere. Only yields reasonable results for references PATH like structures or properties.
Parameters:
  ref - reference



setResource
public void setResource(String resource)(Code)
The resource name of a property file to load
Parameters:
  resource - resource on classpath



setUrl
public void setUrl(URL url)(Code)
The url from which to load properties.
Parameters:
  url - url string



setUserProperty
public void setUserProperty(boolean userProperty)(Code)

Parameters:
  userProperty - ignored



setValue
public void setValue(String value)(Code)
The value of the property.
Parameters:
  value - value to assign



toString
public String toString()(Code)
get the value of this property the current value or the empty string



Fields inherited from org.apache.tools.ant.Task
protected Target target(Code)(Java Doc)
protected String taskName(Code)(Java Doc)
protected String taskType(Code)(Java Doc)
protected RuntimeConfigurable wrapper(Code)(Java Doc)

Methods inherited from org.apache.tools.ant.Task
final public void bindToOwner(Task owner)(Code)(Java Doc)
public void execute() throws BuildException(Code)(Java Doc)
public Target getOwningTarget()(Code)(Java Doc)
public RuntimeConfigurable getRuntimeConfigurableWrapper()(Code)(Java Doc)
public String getTaskName()(Code)(Java Doc)
public String getTaskType()(Code)(Java Doc)
protected RuntimeConfigurable getWrapper()(Code)(Java Doc)
protected void handleErrorFlush(String output)(Code)(Java Doc)
protected void handleErrorOutput(String output)(Code)(Java Doc)
protected void handleFlush(String output)(Code)(Java Doc)
protected int handleInput(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc)
protected void handleOutput(String output)(Code)(Java Doc)
public void init() throws BuildException(Code)(Java Doc)
final protected boolean isInvalid()(Code)(Java Doc)
public void log(String msg)(Code)(Java Doc)
public void log(String msg, int msgLevel)(Code)(Java Doc)
public void log(Throwable t, int msgLevel)(Code)(Java Doc)
public void log(String msg, Throwable t, int msgLevel)(Code)(Java Doc)
public void maybeConfigure() throws BuildException(Code)(Java Doc)
final public void perform()(Code)(Java Doc)
public void reconfigure()(Code)(Java Doc)
public void setOwningTarget(Target target)(Code)(Java Doc)
public void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)(Code)(Java Doc)
public void setTaskName(String name)(Code)(Java Doc)
public void setTaskType(String type)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.