TILESSB-38
Fixed tiles-autotag-core-runtime checkstyle.
git-svn-id: https://svn.apache.org/repos/asf/tiles/sandbox/trunk/tiles-autotag@1044817 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java
index 6feb2d9..8fc9da9 100644
--- a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
package org.apache.tiles.autotag.core.runtime;
import java.io.IOException;
@@ -6,10 +26,23 @@
import org.apache.tiles.autotag.core.runtime.util.NullWriter;
+/**
+ * Base class for the abstraction of the body.
+ *
+ * @version $Rev$ $Date$
+ */
public abstract class AbstractModelBody implements ModelBody {
+ /**
+ * The default writer to use.
+ */
private Writer defaultWriter;
+ /**
+ * Constructor.
+ *
+ * @param defaultWriter The default writer to use.
+ */
public AbstractModelBody(Writer defaultWriter) {
this.defaultWriter = defaultWriter;
}
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java
index 6b5f465..81178ee 100644
--- a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java
@@ -1,15 +1,62 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
package org.apache.tiles.autotag.core.runtime;
import java.io.IOException;
import java.io.Writer;
+/**
+ * Abstracts a tag/directive body.
+ *
+ * @version $Rev$ $Date$
+ */
public interface ModelBody {
+ /**
+ * Evaluates a body and returns it as a string.
+ *
+ * @return The body, as a string.
+ * @throws IOException If something goes wrong.
+ */
String evaluateAsString() throws IOException;
+ /**
+ * Evaluates a body, but discards result.
+ *
+ * @throws IOException If something goes wrong.
+ */
void evaluateWithoutWriting() throws IOException;
+ /**
+ * Evaluates the body and writes in the default writer.
+ *
+ * @throws IOException If something goes wrong.
+ */
void evaluate() throws IOException;
+ /**
+ * Evaluates the body and writes the result in the writer.
+ *
+ * @param writer The writer to write the result into.
+ * @throws IOException If something goes wrong.
+ */
void evaluate(Writer writer) throws IOException;
}
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/Parameter.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/Parameter.java
index 3421fd2..6f9c99b 100644
--- a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/Parameter.java
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/Parameter.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
package org.apache.tiles.autotag.core.runtime.annotation;
import java.lang.annotation.ElementType;
@@ -5,15 +25,32 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Specifies behaviour for a parameter of the "execute" method of a template class.
+ *
+ * @version $Rev$ $Date$
+ */
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.PARAMETER)
public @interface Parameter {
- static final String SAME_NAME = "USE THE SAME NAME";
+ /**
+ * Indicates to use the parameter name itself for the exported name.
+ */
+ String SAME_NAME = "USE THE SAME NAME";
+ /**
+ * Returns the name of the exported property name.
+ */
String name() default SAME_NAME;
+ /**
+ * Indicates that this parameter is required.
+ */
boolean required() default false;
+ /**
+ * Indicates the default value, as it will be written in Java code.
+ */
String defaultValue() default "null";
}
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/package-info.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/package-info.java
new file mode 100644
index 0000000..261b48e
--- /dev/null
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/annotation/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+/**
+ * Annotations to be used in template classes.
+ */
+package org.apache.tiles.autotag.core.runtime.annotation;
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtil.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtil.java
index 6eb91a0..0e812b6 100644
--- a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtil.java
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtil.java
@@ -68,7 +68,7 @@
/**
* Returns the current compose stack, or creates a new one if not present.
*
- * @param env The current FreeMarker environment.
+ * @param request The request.
* @return The compose stack.
* @since 3.0.0
*/
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/package-info.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/package-info.java
new file mode 100644
index 0000000..0e43577
--- /dev/null
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/composition/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+/**
+ * Contains classes to compose objects between template invocations.
+ */
+package org.apache.tiles.autotag.core.runtime.composition;
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/package-info.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/package-info.java
new file mode 100644
index 0000000..1e8324a
--- /dev/null
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+/**
+ * Runtime part for all Autotag generated code.
+ */
+package org.apache.tiles.autotag.core.runtime;
diff --git a/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/util/package-info.java b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/util/package-info.java
new file mode 100644
index 0000000..7f2e356
--- /dev/null
+++ b/tiles-autotag-core-runtime/src/main/java/org/apache/tiles/autotag/core/runtime/util/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+/**
+ * Utilities for Autotag core runtime.
+ */
+package org.apache.tiles.autotag.core.runtime.util;
diff --git a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/AbstractModelBodyTest.java b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/AbstractModelBodyTest.java
index 62c9b2f..c37ef45 100644
--- a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/AbstractModelBodyTest.java
+++ b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/AbstractModelBodyTest.java
@@ -1,5 +1,22 @@
-/**
+/*
+ * $Id$
*
+ * 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.
*/
package org.apache.tiles.autotag.core.runtime;
@@ -53,7 +70,7 @@
* Test method for {@link org.apache.tiles.autotag.core.runtime.AbstractModelBody#evaluateAsString()}.
* @throws IOException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testEvaluateAsStringException() throws IOException {
Writer writer = createMock(Writer.class);
AbstractModelBody modelBody = createMockBuilder(AbstractModelBody.class).withConstructor(writer).createMock();
@@ -89,7 +106,7 @@
* Test method for {@link org.apache.tiles.autotag.core.runtime.AbstractModelBody#evaluateWithoutWriting()}.
* @throws IOException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testEvaluateWithoutWritingException() throws IOException {
Writer writer = createMock(Writer.class);
AbstractModelBody modelBody = createMockBuilder(AbstractModelBody.class).withConstructor(writer).createMock();
@@ -105,10 +122,24 @@
}
}
+ /**
+ * A mock model body.
+ *
+ * @version $Rev$ $Date$
+ */
public static class MockModelBody extends AbstractModelBody {
+ /**
+ * The result to return.
+ */
private String toReturn;
+ /**
+ * Constructor.
+ *
+ * @param defaultWriter The default writer.
+ * @param toReturn The result to return.
+ */
public MockModelBody(Writer defaultWriter, String toReturn) {
super(defaultWriter);
this.toReturn = toReturn;
diff --git a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtilTest.java b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtilTest.java
index c8ee4fa..602db97 100644
--- a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtilTest.java
+++ b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/composition/ComposeStackUtilTest.java
@@ -30,7 +30,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.tiles.autotag.core.runtime.composition.ComposeStackUtil;
import org.apache.tiles.request.Request;
import org.junit.Test;
@@ -84,16 +83,14 @@
expect(request.getContext("request")).andReturn(requestScope);
replay(request);
- assertSame(ComposeStackUtil.getComposeStack(request), requestScope.get(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME));
+ assertSame(ComposeStackUtil.getComposeStack(request),
+ requestScope.get(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME));
verify(request);
}
/**
* Tests {@link ComposeStackUtil#getComposeStack(org.apache.tiles.request.Request)}.
*/
- /**
- * Tests {@link ComposeStackUtil#getComposeStack(org.apache.tiles.request.Request)}.
- */
@Test
public void testGetComposeStackNotNull() {
Request request = createMock(Request.class);
@@ -109,6 +106,9 @@
verify(request, composeStack);
}
+ /**
+ * Tests {@link ComposeStackUtil#getComposeStack(org.apache.tiles.request.Request)}.
+ */
@Test
public void testGetComposeStackNoNull() {
Request request = createMock(Request.class);
@@ -117,7 +117,8 @@
expect(request.getContext("request")).andReturn(requestScope);
replay(request);
- assertSame(ComposeStackUtil.getComposeStack(request), requestScope.get(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME));
+ assertSame(ComposeStackUtil.getComposeStack(request),
+ requestScope.get(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME));
verify(request);
}
}
diff --git a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/util/NullWriterTest.java b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/util/NullWriterTest.java
index 793258d..f8a2ba2 100644
--- a/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/util/NullWriterTest.java
+++ b/tiles-autotag-core-runtime/src/test/java/org/apache/tiles/autotag/core/runtime/util/NullWriterTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.tiles.autotag.core.runtime.util;
-import org.apache.tiles.autotag.core.runtime.util.NullWriter;
import org.junit.Before;
import org.junit.Test;