You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2010/12/29 07:09:02 UTC
svn commit: r1053540 - in
/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util:
TemplateBoolean.java TemplateString.java
Author: nbubna
Date: Wed Dec 29 06:09:01 2010
New Revision: 1053540
URL: http://svn.apache.org/viewvc?rev=1053540&view=rev
Log:
add new 'duck-type' interfaces for strings and booleans
Added:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java (with props)
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java (with props)
Added: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java?rev=1053540&view=auto
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java (added)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java Wed Dec 29 06:09:01 2010
@@ -0,0 +1,38 @@
+package org.apache.velocity.util;
+
+/*
+ * 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.
+ */
+
+/**
+ * Any object in the context which implements TemplateBoolean will use the
+ * getAsBoolean() method for #if( $ref ) calls.
+ *
+ * @author Nathan Bubna
+ * @since 2.0
+ */
+public interface TemplateBoolean
+{
+
+ /**
+ * Returns a boolean that can be used in a template.
+ * @return A boolean that can be used in a template.
+ */
+ public boolean getAsBoolean();
+
+}
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java
------------------------------------------------------------------------------
svn:keywords = Revision
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java?rev=1053540&view=auto
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java (added)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java Wed Dec 29 06:09:01 2010
@@ -0,0 +1,38 @@
+package org.apache.velocity.util;
+
+/*
+ * 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.
+ */
+
+/**
+ * Any object in the context which implements TemplateString will use the
+ * getAsString() method for rendering and empty-checks instead of toString().
+ *
+ * @author Nathan Bubna
+ * @since 2.0
+ */
+public interface TemplateString
+{
+
+ /**
+ * Returns a String that can be used in a template.
+ * @return A String that can be used in a template.
+ */
+ public String getAsString();
+
+}
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java
------------------------------------------------------------------------------
svn:keywords = Revision
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java
------------------------------------------------------------------------------
svn:mime-type = text/plain