KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > project > support > ant > PropertyEvaluator


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.project.support.ant;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.util.Map JavaDoc;
24
25 /**
26  * A way of mapping property names to values.
27  * <p>
28  * This interface defines no independent thread safety, but in typical usage
29  * it will be used with the project manager mutex. Changes should be fired
30  * synchronously.
31  * @author Jesse Glick
32  * @see PropertyUtils#sequentialPropertyEvaluator
33  * @see AntProjectHelper#getStandardPropertyEvaluator
34  */

35 public interface PropertyEvaluator {
36
37     /**
38      * Evaluate a single property.
39      * @param prop the name of a property
40      * @return its value, or null if it is not defined or its value could not be
41      * retrieved for some reason (e.g. a circular definition)
42      */

43     String JavaDoc getProperty(String JavaDoc prop);
44     
45     /**
46      * Evaluate a block of text possibly containing property references.
47      * The syntax is the same as for Ant: <samp>${foo}</samp> means the value
48      * of the property <samp>foo</samp>; <samp>$$</samp> is an escape for
49      * <samp>$</samp>; references to undefined properties are left unsubstituted.
50      * @param text some text possibly containing one or more property references
51      * @return its value, or null if some problem (such a circular definition) made
52      * it impossible to retrieve the values of some properties
53      */

54     String JavaDoc evaluate(String JavaDoc text);
55     
56     /**
57      * Get a set of all current property definitions at once.
58      * This may be more efficient than evaluating individual properties,
59      * depending on the implementation.
60      * @return an immutable map from property names to values, or null if the
61      * mapping could not be computed (e.g. due to a circular definition)
62      */

63     Map JavaDoc<String JavaDoc,String JavaDoc> getProperties();
64     
65     /**
66      * Add a listener to changes in particular property values.
67      * As generally true with property change listeners, the old and new
68      * values may both be null in case the true values are not known or not
69      * easily computed; and the property name might be null to signal that any
70      * property might have changed.
71      * @param listener a listener to add
72      */

73     void addPropertyChangeListener(PropertyChangeListener JavaDoc listener);
74     
75     /**
76      * Remove a listener to changes in particular property values.
77      * @param listener a listener to remove
78      */

79     void removePropertyChangeListener(PropertyChangeListener JavaDoc listener);
80     
81 }
82
Popular Tags