You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2013/04/24 23:57:54 UTC
svn commit: r1471713 -
/commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
Author: mbenson
Date: Wed Apr 24 21:57:50 2013
New Revision: 1471713
URL: http://svn.apache.org/r1471713
Log:
extract inlineProperties type
Added:
commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
Added: commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java?rev=1471713&view=auto
==============================================================================
--- commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java (added)
+++ commons/sandbox/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java Wed Apr 24 21:57:50 2013
@@ -0,0 +1,50 @@
+/*
+ * Copyright the original author or authors.
+ *
+ * Licensed 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.
+ */
+package org.apache.commons.weaver.ant;
+
+import java.util.Properties;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.tools.ant.DynamicElement;
+
+/**
+ * Structure to allow the inline specification of weaver properties.
+ */
+public class InlineProperties implements DynamicElement {
+ /**
+ * Represents a single inline property.
+ */
+ public class InlineProperty {
+ private final String name;
+
+ private InlineProperty(String name) {
+ this.name = name;
+ }
+
+ public void addText(String text) {
+ if (properties.containsKey(name)) {
+ text = StringUtils.join(properties.getProperty(name), text);
+ }
+ properties.setProperty(name, text);
+ }
+ }
+
+ final Properties properties = new Properties();
+
+ public InlineProperty createDynamicElement(String name) {
+ return new InlineProperty(name);
+ }
+}
\ No newline at end of file