You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2025/03/28 17:13:11 UTC
(sling-org-apache-sling-scripting-sightly-runtime) branch master updated (53a1865 -> 743668e)
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-runtime.git
from 53a1865 SLING-12459 - Redirect sonarcloud notifications to commits@apache.sling.org
new b791a46 SLING-12730 Update to Parent 62
new 743668e SLING-12730 apply spotless formatting
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.sling-module.json | 5 +
pom.xml | 163 +++++++--------------
.../org/apache/sling/scripting/sightly/Record.java | 6 +-
.../sling/scripting/sightly/SightlyException.java | 33 +++--
.../sightly/extension/RuntimeExtension.java | 5 +-
.../sling/scripting/sightly/package-info.java | 1 -
.../apache/sling/scripting/sightly/pojo/Use.java | 5 +-
.../sightly/render/AbstractRuntimeObjectModel.java | 45 +++---
.../scripting/sightly/render/ObjectModel.java | 76 +++++-----
.../scripting/sightly/render/RenderContext.java | 30 ++--
.../sling/scripting/sightly/render/RenderUnit.java | 53 +++----
.../sightly/render/RuntimeObjectModel.java | 34 +++--
.../scripting/sightly/use/ProviderOutcome.java | 4 +-
.../sling/scripting/sightly/use/UseProvider.java | 6 +-
.../render/AbstractRuntimeObjectModelTest.java | 81 +++++-----
.../scripting/sightly/render/ObjectModelTest.java | 137 +++++++++--------
.../sightly/render/testobjects/Person.java | 37 +++--
.../sightly/render/testobjects/TestEnum.java | 38 +++--
.../sightly/render/testobjects/TestEnum2.java | 42 +++---
.../testobjects/internal/AbstractPerson.java | 36 ++---
.../sightly/render/testobjects/internal/Adult.java | 36 ++---
.../render/testobjects/internal/AdultFactory.java | 36 ++---
22 files changed, 441 insertions(+), 468 deletions(-)
create mode 100644 .sling-module.json
(sling-org-apache-sling-scripting-sightly-runtime) 01/02: SLING-12730 Update to Parent 62
Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-runtime.git
commit b791a46b8f92ee617e4ad8a400a8e75fc4ba2de6
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Fri Mar 28 18:03:24 2025 +0100
SLING-12730 Update to Parent 62
---
.sling-module.json | 5 +++++
pom.xml | 55 +-----------------------------------------------------
2 files changed, 6 insertions(+), 54 deletions(-)
diff --git a/.sling-module.json b/.sling-module.json
new file mode 100644
index 0000000..cfad4d2
--- /dev/null
+++ b/.sling-module.json
@@ -0,0 +1,5 @@
+{
+ "jenkins": {
+ "jdks": [17, 21]
+ }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4286413..1abf5bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>44</version>
+ <version>62</version>
<relativePath />
</parent>
@@ -61,24 +61,6 @@
<!-- ======================================================================= -->
<build>
<plugins>
- <plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
- <version>3.1.11</version>
- <configuration>
- <effort>Max</effort>
- <xmlOutput>true</xmlOutput>
- </configuration>
- <executions>
- <execution>
- <id>find-bugs</id>
- <phase>process-classes</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -90,41 +72,6 @@
</configuration>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- com.github.spotbugs
- </groupId>
- <artifactId>
- spotbugs-maven-plugin
- </artifactId>
- <versionRange>
- [3.1.11,)
- </versionRange>
- <goals>
- <goal>check</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
<profiles>
(sling-org-apache-sling-scripting-sightly-runtime) 02/02: SLING-12730 apply spotless formatting
Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-runtime.git
commit 743668e2223bfa48aefa584c787d5d679d829c80
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Fri Mar 28 18:03:42 2025 +0100
SLING-12730 apply spotless formatting
---
pom.xml | 108 ++++++++--------
.../org/apache/sling/scripting/sightly/Record.java | 6 +-
.../sling/scripting/sightly/SightlyException.java | 33 ++---
.../sightly/extension/RuntimeExtension.java | 5 +-
.../sling/scripting/sightly/package-info.java | 1 -
.../apache/sling/scripting/sightly/pojo/Use.java | 5 +-
.../sightly/render/AbstractRuntimeObjectModel.java | 45 +++----
.../scripting/sightly/render/ObjectModel.java | 76 ++++++------
.../scripting/sightly/render/RenderContext.java | 30 ++---
.../sling/scripting/sightly/render/RenderUnit.java | 53 ++++----
.../sightly/render/RuntimeObjectModel.java | 34 ++---
.../scripting/sightly/use/ProviderOutcome.java | 4 +-
.../sling/scripting/sightly/use/UseProvider.java | 6 +-
.../render/AbstractRuntimeObjectModelTest.java | 81 ++++++------
.../scripting/sightly/render/ObjectModelTest.java | 137 ++++++++++++---------
.../sightly/render/testobjects/Person.java | 37 +++---
.../sightly/render/testobjects/TestEnum.java | 38 +++---
.../sightly/render/testobjects/TestEnum2.java | 42 +++----
.../testobjects/internal/AbstractPerson.java | 36 +++---
.../sightly/render/testobjects/internal/Adult.java | 36 +++---
.../render/testobjects/internal/AdultFactory.java | 36 +++---
21 files changed, 435 insertions(+), 414 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1abf5bb..2d7d225 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -39,16 +39,14 @@
<name>Apache Sling Scripting HTL Runtime</name>
- <description>
- The Apache Sling Scripting HTL Runtime provides support for executing HTL Java compiled units produced by the org.apache.sling.scripting.sightly.compiler.java module.
- </description>
+ <description>The Apache Sling Scripting HTL Runtime provides support for executing HTL Java compiled units produced by the org.apache.sling.scripting.sightly.compiler.java module.</description>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-runtime.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-runtime.git</developerConnection>
+ <tag>HEAD</tag>
<url>https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime.git</url>
- <tag>HEAD</tag>
- </scm>
+ </scm>
<properties>
<jacoco.maven.plugin.version>0.8.2</jacoco.maven.plugin.version>
@@ -56,6 +54,53 @@
<project.build.outputTimestamp>2021-04-23T16:34:16Z</project.build.outputTimestamp>
</properties>
+ <!-- ======================================================================= -->
+ <!-- D E P E N D E N C I E S -->
+ <!-- ======================================================================= -->
+ <dependencies>
+
+ <!-- OSGi -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.annotation.versioning</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Apache Commons -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<!-- ======================================================================= -->
<!-- B U I L D -->
<!-- ======================================================================= -->
@@ -66,9 +111,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- No javadocs -->
- <excludePackageNames>
- org.apache.sling.scripting.sightly.java.compiler.impl
- </excludePackageNames>
+ <excludePackageNames>org.apache.sling.scripting.sightly.java.compiler.impl</excludePackageNames>
</configuration>
</plugin>
</plugins>
@@ -111,51 +154,4 @@
</profile>
</profiles>
- <!-- ======================================================================= -->
- <!-- D E P E N D E N C I E S -->
- <!-- ======================================================================= -->
- <dependencies>
-
- <!-- OSGi -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.annotation.versioning</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- Apache Commons -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
</project>
diff --git a/src/main/java/org/apache/sling/scripting/sightly/Record.java b/src/main/java/org/apache/sling/scripting/sightly/Record.java
index 5c8be4a..70bcad4 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/Record.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/Record.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* 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
@@ -15,8 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
-
+ */
package org.apache.sling.scripting.sightly;
import java.util.Set;
@@ -47,5 +46,4 @@ public interface Record<T> {
* @return this record's properties' names
*/
Set<String> getPropertyNames();
-
}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/SightlyException.java b/src/main/java/org/apache/sling/scripting/sightly/SightlyException.java
index 16111ee..da02da8 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/SightlyException.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/SightlyException.java
@@ -1,19 +1,21 @@
-/*******************************************************************************
- * 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
+ * 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.
- ******************************************************************************/
+ * 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.sling.scripting.sightly;
/**
@@ -21,8 +23,7 @@ package org.apache.sling.scripting.sightly;
*/
public class SightlyException extends RuntimeException {
- public SightlyException() {
- }
+ public SightlyException() {}
public SightlyException(String message) {
super(message);
diff --git a/src/main/java/org/apache/sling/scripting/sightly/extension/RuntimeExtension.java b/src/main/java/org/apache/sling/scripting/sightly/extension/RuntimeExtension.java
index 0348e5f..cb1981b 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/extension/RuntimeExtension.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/extension/RuntimeExtension.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* 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
@@ -15,11 +15,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.sling.scripting.sightly.extension;
import org.apache.sling.scripting.sightly.render.RenderContext;
-
import org.osgi.annotation.versioning.ConsumerType;
/**
diff --git a/src/main/java/org/apache/sling/scripting/sightly/package-info.java b/src/main/java/org/apache/sling/scripting/sightly/package-info.java
index f2af1f3..a7a94e0 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/package-info.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/package-info.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
-
@Version("2.0.0")
package org.apache.sling.scripting.sightly;
diff --git a/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java b/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java
index 722b79a..eaab014 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* 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
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.sling.scripting.sightly.pojo;
import javax.script.Bindings;
@@ -43,5 +43,4 @@ public interface Use {
* @param bindings The Java Scripting API bindings.
*/
void init(Bindings bindings);
-
}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
index 473086f..2318192 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
@@ -1,19 +1,21 @@
-/*******************************************************************************
- * 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
+ * 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.
- ******************************************************************************/
+ * 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.sling.scripting.sightly.render;
import java.time.Instant;
@@ -58,8 +60,10 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
@Override
public boolean isCollection(Object target) {
- return (target instanceof Collection) || (target instanceof Object[]) || (target instanceof Iterable) ||
- (target instanceof Iterator);
+ return (target instanceof Collection)
+ || (target instanceof Object[])
+ || (target instanceof Iterable)
+ || (target instanceof Iterator);
}
@Override
@@ -90,9 +94,9 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
@Override
public Date toDate(Object object) {
if (object instanceof Date) {
- return (Date)object;
+ return (Date) object;
} else if (object instanceof Calendar) {
- return ((Calendar)object).getTime();
+ return ((Calendar) object).getTime();
} else if (object instanceof Instant) {
return Date.from((Instant) object);
}
@@ -102,9 +106,9 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
@Override
public Instant toInstant(Object object) {
if (object instanceof Date) {
- return ((Date)object).toInstant();
+ return ((Date) object).toInstant();
} else if (object instanceof Calendar) {
- return (((Calendar)object)).toInstant();
+ return (((Calendar) object)).toInstant();
} else if (object instanceof Instant) {
return (Instant) object;
}
@@ -154,5 +158,4 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
}
return result;
}
-
}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java
index 07523c0..a764cdf 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render;
import java.lang.reflect.Array;
@@ -66,7 +66,6 @@ public final class ObjectModel {
PRIMITIVE_CLASSES = Collections.unmodifiableSet(primitivesBuilder);
}
-
private static final String TO_STRING_METHOD = "toString";
private ObjectModel() {}
@@ -250,7 +249,11 @@ public final class ObjectModel {
return ((Enum) object).name();
} else if (object instanceof Optional) {
return toString(((Optional) object).orElse(EMPTY_STRING));
- } else if (object.getClass().isArray() || object instanceof Collection || object instanceof Enumeration || object instanceof Iterator || object instanceof Iterable) {
+ } else if (object.getClass().isArray()
+ || object instanceof Collection
+ || object instanceof Enumeration
+ || object instanceof Iterator
+ || object instanceof Iterable) {
Collection<?> col = toCollection(object);
output = collectionToString(col);
} else {
@@ -365,10 +368,10 @@ public final class ObjectModel {
}
// special handing for enum object
- if (object instanceof Class && ((Class<?>)object).isEnum()) {
- Class<?> cls = (Class<?>)object;
+ if (object instanceof Class && ((Class<?>) object).isEnum()) {
+ Class<?> cls = (Class<?>) object;
if (index >= 0 && index < cls.getEnumConstants().length) {
- //find the enum constant whose ordinal matches the requested index
+ // find the enum constant whose ordinal matches the requested index
return cls.getEnumConstants()[index];
} else {
return null;
@@ -400,8 +403,8 @@ public final class ObjectModel {
Class<?> cls;
// special handing for enum object
- if (object instanceof Class && ((Class<?>)object).isEnum()) {
- cls = (Class<?>)object;
+ if (object instanceof Class && ((Class<?>) object).isEnum()) {
+ cls = (Class<?>) object;
} else {
cls = object.getClass();
}
@@ -409,12 +412,11 @@ public final class ObjectModel {
if (cls.isArray() && "length".equals(fieldName)) {
return Array.getLength(object);
}
- for (Field field : cls.getFields()){
- if (field.getName().equals(fieldName)){
+ for (Field field : cls.getFields()) {
+ if (field.getName().equals(fieldName)) {
try {
return field.get(object);
- }
- catch (IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
return null;
}
}
@@ -436,8 +438,8 @@ public final class ObjectModel {
}
Class<?> cls;
// special handing for enum object
- if (object instanceof Class && ((Class<?>)object).isEnum()) {
- cls = (Class<?>)object;
+ if (object instanceof Class && ((Class<?>) object).isEnum()) {
+ cls = (Class<?>) object;
} else {
cls = object.getClass();
}
@@ -464,10 +466,10 @@ public final class ObjectModel {
if (object == null || StringUtils.isEmpty(valueName)) {
return null;
}
- if (object instanceof Class && ((Class<?>)object).isEnum()) {
+ if (object instanceof Class && ((Class<?>) object).isEnum()) {
try {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- Enum<?> value = Enum.valueOf((Class<Enum>)object, valueName);
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ Enum<?> value = Enum.valueOf((Class<Enum>) object, valueName);
return value;
} catch (IllegalArgumentException e) {
// not a valid enum value?
@@ -498,7 +500,9 @@ public final class ObjectModel {
for (Method method : publicMethods) {
if (method.getParameterTypes().length == 0) {
String methodName = method.getName();
- if (baseName.equals(methodName) || ("get" + capitalized).equals(methodName) || ("is" + capitalized).equals(methodName)) {
+ if (baseName.equals(methodName)
+ || ("get" + capitalized).equals(methodName)
+ || ("is" + capitalized).equals(methodName)) {
if (isMethodAllowed(method)) {
return method;
}
@@ -552,6 +556,4 @@ public final class ObjectModel {
}
return null;
}
-
-
}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/RenderContext.java b/src/main/java/org/apache/sling/scripting/sightly/render/RenderContext.java
index d57e4c8..6b48952 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/RenderContext.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/RenderContext.java
@@ -1,19 +1,21 @@
-/*******************************************************************************
- * 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
+ * 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.
- ******************************************************************************/
+ * 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.sling.scripting.sightly.render;
import javax.script.Bindings;
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/RenderUnit.java b/src/main/java/org/apache/sling/scripting/sightly/render/RenderUnit.java
index 23c0cb8..f0b14a9 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/RenderUnit.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/RenderUnit.java
@@ -1,23 +1,26 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render;
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
+
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.Collection;
@@ -27,9 +30,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import javax.script.Bindings;
-import javax.script.SimpleBindings;
-
import org.apache.sling.scripting.sightly.Record;
/**
@@ -63,10 +63,7 @@ public abstract class RenderUnit implements Record<RenderUnit> {
return subTemplates.keySet();
}
- protected abstract void render(PrintWriter out,
- Bindings bindings,
- Bindings arguments,
- RenderContext renderContext);
+ protected abstract void render(PrintWriter out, Bindings bindings, Bindings arguments, RenderContext renderContext);
@SuppressWarnings({"unused", "unchecked"})
protected void callUnit(PrintWriter out, RenderContext renderContext, Object templateObj, Object argsObj) {
@@ -75,8 +72,8 @@ public abstract class RenderUnit implements Record<RenderUnit> {
throw new RuntimeException("data-sly-call: expression evaluates to null.");
}
if (renderContext.getObjectModel().isPrimitive(templateObj)) {
- throw new RuntimeException(
- "data-sly-call: primitive \"" + templateObj.toString() + "\" does not represent a HTL template.");
+ throw new RuntimeException("data-sly-call: primitive \"" + templateObj.toString()
+ + "\" does not represent a HTL template.");
} else if (templateObj instanceof String) {
throw new RuntimeException(
"data-sly-call: String '" + templateObj.toString() + "' does not represent a HTL template.");
@@ -127,7 +124,6 @@ public abstract class RenderUnit implements Record<RenderUnit> {
put(name, value);
return this;
}
-
}
private static final class CaseInsensitiveBindings implements Bindings {
@@ -228,5 +224,4 @@ public abstract class RenderUnit implements Record<RenderUnit> {
return entrySet;
}
}
-
}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/RuntimeObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/render/RuntimeObjectModel.java
index 845b67e..a238448 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/RuntimeObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/RuntimeObjectModel.java
@@ -1,19 +1,21 @@
-/*******************************************************************************
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- ******************************************************************************/
+/*
+ * 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.sling.scripting.sightly.render;
import java.time.Instant;
diff --git a/src/main/java/org/apache/sling/scripting/sightly/use/ProviderOutcome.java b/src/main/java/org/apache/sling/scripting/sightly/use/ProviderOutcome.java
index 83fb379..283cb14 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/use/ProviderOutcome.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/use/ProviderOutcome.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* 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
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.sling.scripting.sightly.use;
/**
diff --git a/src/main/java/org/apache/sling/scripting/sightly/use/UseProvider.java b/src/main/java/org/apache/sling/scripting/sightly/use/UseProvider.java
index 14a78ba..5f3025d 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/use/UseProvider.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/use/UseProvider.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* 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
@@ -15,14 +15,12 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
-
+ */
package org.apache.sling.scripting.sightly.use;
import javax.script.Bindings;
import org.apache.sling.scripting.sightly.render.RenderContext;
-
import org.osgi.annotation.versioning.ConsumerType;
/**
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModelTest.java b/src/test/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModelTest.java
index 5f7df3d..3e46452 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModelTest.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModelTest.java
@@ -1,19 +1,21 @@
-/*******************************************************************************
- * 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
+ * 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.
- ******************************************************************************/
+ * 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.sling.scripting.sightly.render;
import java.time.Instant;
@@ -54,23 +56,29 @@ public class AbstractRuntimeObjectModelTest {
assertEquals(2, runtimeObjectModel.resolveProperty(testList, 1));
assertNull(runtimeObjectModel.resolveProperty(testList, 3));
assertNull(runtimeObjectModel.resolveProperty(testList, -1));
- Map<String, Integer> map = new HashMap<String, Integer>() {{
- put("one", 1);
- put("two", 2);
- }};
+ Map<String, Integer> map = new HashMap<String, Integer>() {
+ {
+ put("one", 1);
+ put("two", 2);
+ }
+ };
assertEquals(1, runtimeObjectModel.resolveProperty(map, "one"));
assertNull(runtimeObjectModel.resolveProperty(map, null));
assertNull(runtimeObjectModel.resolveProperty(map, ""));
- Map<Integer, String> stringMap = new HashMap<Integer, String>(){{
- put(1, "one");
- put(2, "two");
- }};
+ Map<Integer, String> stringMap = new HashMap<Integer, String>() {
+ {
+ put(1, "one");
+ put(2, "two");
+ }
+ };
assertEquals("one", runtimeObjectModel.resolveProperty(stringMap, 1));
assertEquals("two", runtimeObjectModel.resolveProperty(stringMap, 2));
- Map<String, String> strings = new HashMap<String, String>(){{
- put("a", "one");
- put("b", "two");
- }};
+ Map<String, String> strings = new HashMap<String, String>() {
+ {
+ put("a", "one");
+ put("b", "two");
+ }
+ };
Record<String> record = new Record<String>() {
@Override
public String getProperty(String name) {
@@ -137,10 +145,12 @@ public class AbstractRuntimeObjectModelTest {
assertTrue(runtimeObjectModel.toCollection(null).isEmpty());
Record<String> record = new Record<String>() {
- private Map<String, String> properties = new HashMap<String, String>() {{
- put("a", "1");
- put("b", "2");
- }};
+ private Map<String, String> properties = new HashMap<String, String>() {
+ {
+ put("a", "1");
+ put("b", "2");
+ }
+ };
@Override
public String getProperty(String name) {
@@ -160,10 +170,12 @@ public class AbstractRuntimeObjectModelTest {
@Test
public void testToMap() {
- final Map<String, String> properties = new HashMap<String, String>() {{
- put("a", "1");
- put("b", "2");
- }};
+ final Map<String, String> properties = new HashMap<String, String>() {
+ {
+ put("a", "1");
+ put("b", "2");
+ }
+ };
assertEquals(properties, runtimeObjectModel.toMap(properties));
Record<String> record = new Record<String>() {
@Override
@@ -179,5 +191,4 @@ public class AbstractRuntimeObjectModelTest {
assertEquals(properties, runtimeObjectModel.toMap(record));
assertTrue(runtimeObjectModel.toMap(null).isEmpty());
}
-
}
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/ObjectModelTest.java b/src/test/java/org/apache/sling/scripting/sightly/render/ObjectModelTest.java
index e24eb07..77917ce 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/ObjectModelTest.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/ObjectModelTest.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render;
import java.net.URI;
@@ -68,19 +68,21 @@ public class ObjectModelTest {
List testList = Arrays.asList(testArray);
assertTrue(ObjectModel.toBoolean(testArray));
assertTrue(ObjectModel.toBoolean(testPrimitiveArray));
- assertFalse(ObjectModel.toBoolean(new Integer[]{}));
+ assertFalse(ObjectModel.toBoolean(new Integer[] {}));
assertTrue(ObjectModel.toBoolean(testList));
assertFalse(ObjectModel.toBoolean(Collections.emptyList()));
- Map<String, Integer> map = new HashMap<String, Integer>() {{
- put("one", 1);
- put("two", 2);
- }};
+ Map<String, Integer> map = new HashMap<String, Integer>() {
+ {
+ put("one", 1);
+ put("two", 2);
+ }
+ };
assertTrue(ObjectModel.toBoolean(map));
assertFalse(ObjectModel.toBoolean(Collections.EMPTY_MAP));
assertTrue(ObjectModel.toBoolean(testList.iterator()));
assertFalse(ObjectModel.toBoolean(Collections.EMPTY_LIST.iterator()));
assertTrue(ObjectModel.toBoolean(new Bag<>(testArray)));
- assertFalse(ObjectModel.toBoolean(new Bag<>(new Integer[]{})));
+ assertFalse(ObjectModel.toBoolean(new Bag<>(new Integer[] {})));
assertTrue(ObjectModel.toBoolean(new Date()));
assertFalse(ObjectModel.toBoolean(Optional.empty()));
@@ -100,7 +102,6 @@ public class ObjectModelTest {
assertFalse(ObjectModel.toBoolean(map2));
map2.put("one", "entry");
assertTrue(ObjectModel.toBoolean(map2));
-
}
@Test
@@ -150,14 +151,17 @@ public class ObjectModelTest {
Integer[] testArray = new Integer[] {1, 2, 3};
int[] testPrimitiveArray = new int[] {1, 2, 3};
List<Integer> testList = Arrays.asList(testArray);
- Map<String, Integer> map = new HashMap<String, Integer>() {{
- put("one", 1);
- put("two", 2);
- }};
+ Map<String, Integer> map = new HashMap<String, Integer>() {
+ {
+ put("one", 1);
+ put("two", 2);
+ }
+ };
assertEquals(testList, ObjectModel.toCollection(testArray));
assertEquals(testList, ObjectModel.toCollection(testPrimitiveArray));
assertEquals(testList, ObjectModel.toCollection(testList));
- MatcherAssert.assertThat(ObjectModel.toCollection(map), Matchers.contains(map.keySet().toArray()));
+ MatcherAssert.assertThat(
+ ObjectModel.toCollection(map), Matchers.contains(map.keySet().toArray()));
Vector<Integer> vector = new Vector<>(testList);
assertEquals(testList, ObjectModel.toCollection(vector.elements()));
assertEquals(testList, ObjectModel.toCollection(testList.iterator()));
@@ -206,28 +210,41 @@ public class ObjectModelTest {
assertEquals(2, ObjectModel.resolveProperty(testList, 1));
assertNull(ObjectModel.resolveProperty(testList, 3));
assertNull(ObjectModel.resolveProperty(testList, -1));
- Map<String, Integer> map = new HashMap<String, Integer>() {{
- put("one", 1);
- put("two", 2);
- }};
+ Map<String, Integer> map = new HashMap<String, Integer>() {
+ {
+ put("one", 1);
+ put("two", 2);
+ }
+ };
assertEquals(1, ObjectModel.resolveProperty(map, "one"));
assertNull(ObjectModel.resolveProperty(map, null));
assertNull(ObjectModel.resolveProperty(map, ""));
- Map<Integer, String> stringMap = new HashMap<Integer, String>(){{
- put(1, "one");
- put(2, "two");
- }};
+ Map<Integer, String> stringMap = new HashMap<Integer, String>() {
+ {
+ put(1, "one");
+ put(2, "two");
+ }
+ };
assertEquals("one", ObjectModel.resolveProperty(stringMap, 1));
assertEquals("two", ObjectModel.resolveProperty(stringMap, 2));
Person johnDoe = AdultFactory.createAdult("John", "Doe");
- assertEquals("Expected to be able to access public static final constants.", 1l, ObjectModel.resolveProperty(johnDoe, "CONSTANT"));
- assertNull("Did not expect to be able to access public fields from package protected classes.", ObjectModel.resolveProperty(johnDoe,
- "TODAY"));
- assertEquals("Expected to be able to access an array's length property.", 3, ObjectModel.resolveProperty(testArray, "length"));
- assertNotNull("Expected not null result for invocation of interface method on implementation class.",
+ assertEquals(
+ "Expected to be able to access public static final constants.",
+ 1l,
+ ObjectModel.resolveProperty(johnDoe, "CONSTANT"));
+ assertNull(
+ "Did not expect to be able to access public fields from package protected classes.",
+ ObjectModel.resolveProperty(johnDoe, "TODAY"));
+ assertEquals(
+ "Expected to be able to access an array's length property.",
+ 3,
+ ObjectModel.resolveProperty(testArray, "length"));
+ assertNotNull(
+ "Expected not null result for invocation of interface method on implementation class.",
ObjectModel.resolveProperty(johnDoe, "lastName"));
- assertNull("Expected null result for public method available on implementation but not exposed by interface.", ObjectModel
- .resolveProperty(johnDoe, "fullName"));
+ assertNull(
+ "Expected null result for public method available on implementation but not exposed by interface.",
+ ObjectModel.resolveProperty(johnDoe, "fullName"));
assertNull("Expected null result for inexistent method.", ObjectModel.resolveProperty(johnDoe, "nomethod"));
OptionalTest optionalTest = new OptionalTest();
@@ -235,9 +252,9 @@ public class ObjectModelTest {
assertEquals(Optional.of(1), ObjectModel.resolveProperty(optionalTest, "int"));
assertEquals(Optional.of(1), ObjectModel.resolveProperty(Optional.of(optionalTest), "int"));
assertEquals(Optional.of(Integer.valueOf(1)), ObjectModel.resolveProperty(optionalTest, "integer"));
- assertEquals(Optional.of(Integer.valueOf(1)), ObjectModel.resolveProperty(Optional.of(optionalTest), "integer"));
+ assertEquals(
+ Optional.of(Integer.valueOf(1)), ObjectModel.resolveProperty(Optional.of(optionalTest), "integer"));
assertEquals(null, ObjectModel.resolveProperty(Optional.empty(), "integer"));
-
}
/**
@@ -250,7 +267,8 @@ public class ObjectModelTest {
assertEquals(TestEnum2.TWO, ObjectModel.resolveProperty(TestEnum2.class, "TWO"));
assertNull(ObjectModel.resolveProperty(TestEnum.class, "INVALID"));
- assertEquals("Expected to be able to access public static final constants.",
+ assertEquals(
+ "Expected to be able to access public static final constants.",
TestEnum2.STR_CONSTANT,
ObjectModel.resolveProperty(TestEnum2.class, "STR_CONSTANT"));
}
@@ -264,7 +282,7 @@ public class ObjectModelTest {
assertNotNull(value);
assertTrue(value.getClass().isArray());
assertEquals(TestEnum2.class, value.getClass().getComponentType());
- assertArrayEquals(TestEnum2.values(), (TestEnum2[])value);
+ assertArrayEquals(TestEnum2.values(), (TestEnum2[]) value);
assertEquals("value from static method", ObjectModel.resolveProperty(TestEnum2.class, "someStaticMethod1"));
}
@@ -280,10 +298,12 @@ public class ObjectModelTest {
assertEquals(2, ObjectModel.getIndex(testList, 1));
assertNull(ObjectModel.getIndex(testList, 3));
assertNull(ObjectModel.getIndex(testList, -1));
- Map<Integer, String> stringMap = new HashMap<Integer, String>(){{
- put(1, "one");
- put(2, "two");
- }};
+ Map<Integer, String> stringMap = new HashMap<Integer, String>() {
+ {
+ put(1, "one");
+ put(2, "two");
+ }
+ };
assertNull(ObjectModel.getIndex(stringMap, 1));
assertNull(ObjectModel.getIndex(stringMap, 2));
}
@@ -297,7 +317,7 @@ public class ObjectModelTest {
assertEquals(TestEnum2.ONE, ObjectModel.getIndex(TestEnum2.class, 0));
Object two = ObjectModel.getIndex(TestEnum2.class, 1);
assertEquals(TestEnum2.TWO, two);
- assertEquals(TestEnum2.TWO.ordinal(), ((Enum<?>)two).ordinal());
+ assertEquals(TestEnum2.TWO.ordinal(), ((Enum<?>) two).ordinal());
assertNull(ObjectModel.getIndex(TestEnum.class, 100));
}
@@ -314,7 +334,6 @@ public class ObjectModelTest {
assertNull(ObjectModel.invokeBeanMethod(this, ""));
}
-
private class Bag<T> implements Iterable<T> {
private T[] backingArray;
@@ -340,9 +359,7 @@ public class ObjectModelTest {
}
@Override
- public void remove() {
-
- }
+ public void remove() {}
};
}
}
@@ -351,15 +368,17 @@ public class ObjectModelTest {
public Optional<String> getEmpty() {
return Optional.empty();
}
+
public Optional<String> getString() {
return Optional.of("string");
}
+
public Optional<Integer> getInt() {
return Optional.of(1);
}
+
public Optional<Integer> getInteger() {
return Optional.of(Integer.valueOf(1));
}
}
}
-
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/Person.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/Person.java
index fc0c3f8..ab37218 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/Person.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/Person.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects;
public interface Person {
@@ -25,5 +25,4 @@ public interface Person {
String getFirstName();
String getLastName();
-
}
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum.java
index 49c4072..7854860 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum.java
@@ -1,25 +1,23 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects;
public enum TestEnum {
-
CONSTANT
-
}
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum2.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum2.java
index c0a4a41..2d88751 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum2.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/TestEnum2.java
@@ -1,36 +1,36 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects;
/**
* Used for testing/verifying the lookup
- * of the enum values and field constants for a
+ * of the enum values and field constants for a
* "use" object that is an enum class
*/
public enum TestEnum2 {
ONE,
TWO,
THREE;
-
+
public static final String STR_CONSTANT = "constant1";
public static String someStaticMethod1() {
return "value from static method";
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AbstractPerson.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AbstractPerson.java
index 121cd8e..c565bd6 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AbstractPerson.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AbstractPerson.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects.internal;
import org.apache.sling.scripting.sightly.render.testobjects.Person;
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/Adult.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/Adult.java
index 10df9b0..8e5e321 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/Adult.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/Adult.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects.internal;
class Adult extends AbstractPerson {
diff --git a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AdultFactory.java b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AdultFactory.java
index b2f879b..116912a 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AdultFactory.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/render/testobjects/internal/AdultFactory.java
@@ -1,21 +1,21 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*
+ * 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.sling.scripting.sightly.render.testobjects.internal;
public class AdultFactory {