You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2007/09/24 13:57:26 UTC
svn commit: r578770 -
/ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java
Author: peterreilly
Date: Mon Sep 24 04:57:25 2007
New Revision: 578770
URL: http://svn.apache.org/viewvc?rev=578770&view=rev
Log:
use the new PropertyExpander api
Modified:
ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java
Modified: ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java?rev=578770&r1=578769&r2=578770&view=diff
==============================================================================
--- ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java (original)
+++ ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java Mon Sep 24 04:57:25 2007
@@ -1,20 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
package org.apache.ant.props;
@@ -22,22 +20,26 @@
import java.text.ParsePosition;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.property.ParseNextProperty;
+import org.apache.tools.ant.property.PropertyExpander;
/**
- * Oft-requested nested Ant property expansion.
+ * Default expander.
*/
-public class NestedPropertyExpander implements PropertyHelper.PropertyExpander {
-
+public class NestedPropertyExpander implements PropertyExpander {
/**
- * {@inheritDoc}
- * @see org.apache.tools.ant.PropertyHelper.PropertyExpander#parsePropertyName(java.lang.String, java.text.ParsePosition, org.apache.tools.ant.PropertyHelper)
+ * Parse the next property name.
+ * @param value the String to parse.
+ * @param pos the ParsePosition in use.
+ * @param parseNextProperty parse next property
+ * @return parsed String if any, else <code>null</code>.
*/
- public String parsePropertyName(String value, ParsePosition pos, PropertyHelper propertyHelper) {
+ public String parsePropertyName(
+ String value, ParsePosition pos, ParseNextProperty parseNextProperty) {
int start = pos.getIndex();
- Project p = propertyHelper.getProject();
if (value.indexOf("${", start) == start) {
- p.log("Attempting nested property processing", Project.MSG_DEBUG);
+ parseNextProperty.getProject().log(
+ "Attempting nested property processing", Project.MSG_DEBUG);
pos.setIndex(start + 2);
StringBuffer sb = new StringBuffer();
for (int c = pos.getIndex(); c < value.length(); c = pos.getIndex()) {
@@ -45,7 +47,7 @@
pos.setIndex(c + 1);
return sb.toString();
}
- Object o = propertyHelper.parseNextProperty(value, pos);
+ Object o = parseNextProperty.parseNextProperty(value, pos);
if (o != null) {
sb.append(o);
} else {
@@ -57,5 +59,4 @@
pos.setIndex(start);
return null;
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org