diff --git a/declarative/processor/src/main/java/com/inrupt/rdf/wrapping/declarative/processor/Processor.java b/declarative/processor/src/main/java/com/inrupt/rdf/wrapping/declarative/processor/Processor.java index bc7ee40a8..cb878ace3 100644 --- a/declarative/processor/src/main/java/com/inrupt/rdf/wrapping/declarative/processor/Processor.java +++ b/declarative/processor/src/main/java/com/inrupt/rdf/wrapping/declarative/processor/Processor.java @@ -36,9 +36,9 @@ import javax.tools.JavaFileObject; @SupportedAnnotationTypes({ - "com.inrupt.rdf.wrapping.declarative.annotations.Dataset", - "com.inrupt.rdf.wrapping.declarative.annotations.Graph", - "com.inrupt.rdf.wrapping.declarative.annotations.Resource" + "com.inrupt.rdf.wrapping.declarative.annotations.Dataset", + "com.inrupt.rdf.wrapping.declarative.annotations.Graph", + "com.inrupt.rdf.wrapping.declarative.annotations.Resource" }) @SupportedSourceVersion(SourceVersion.RELEASE_8) public class Processor extends AbstractProcessor { @@ -50,15 +50,22 @@ public boolean process(final Set annotations, final Round } for (TypeElement annotation : annotations) { - processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, String.format("annotation [%s]", annotation), annotation); + processingEnv.getMessager().printMessage( + Diagnostic.Kind.NOTE, + String.format("annotation [%s]", annotation), annotation); final Set annotatedElements = roundEnv.getElementsAnnotatedWith(annotation); for (Element annotatedElement : annotatedElements) { - processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, String.format("annotatedElement [%s]", annotatedElement), annotatedElement); + processingEnv.getMessager().printMessage( + Diagnostic.Kind.NOTE, + String.format("annotatedElement [%s]", annotatedElement), annotatedElement); final TypeElement annotatedType = (TypeElement) annotatedElement; final String originalInterfaceName = annotatedType.getQualifiedName().toString(); - final String originalBinaryName = processingEnv.getElementUtils().getBinaryName(annotatedType).toString(); + final String originalBinaryName = processingEnv + .getElementUtils() + .getBinaryName(annotatedType) + .toString(); final String qualifiedName = originalBinaryName + "_$impl"; final int lastDot = originalBinaryName.lastIndexOf('.'); final String implementationClassName = qualifiedName.substring(lastDot + 1); @@ -106,7 +113,10 @@ public boolean process(final Set annotations, final Round return true; } - private void printDataset(final String originalInterfaceName, final String implementationClassName, final PrintWriter out) { + private void printDataset( + final String originalInterfaceName, + final String implementationClassName, + final PrintWriter out) { out.println("import javax.annotation.processing.Generated;"); out.println(); out.println("import org.apache.jena.sparql.core.DatasetGraph;"); @@ -131,7 +141,10 @@ private void printDataset(final String originalInterfaceName, final String imple out.println("}"); } - private void printGraph(final String originalInterfaceName, final String implementationClassName, final PrintWriter out) { + private void printGraph( + final String originalInterfaceName, + final String implementationClassName, + final PrintWriter out) { out.println("import javax.annotation.processing.Generated;"); out.println(); out.println("import org.apache.jena.graph.Graph;"); @@ -156,7 +169,10 @@ private void printGraph(final String originalInterfaceName, final String impleme out.println("}"); } - private void printResource(final String originalInterfaceName, final String implementationClassName, final PrintWriter out) { + private void printResource( + final String originalInterfaceName, + final String implementationClassName, + final PrintWriter out) { out.println("import com.inrupt.rdf.wrapping.jena.UriOrBlankFactory;"); out.println("import com.inrupt.rdf.wrapping.jena.WrapperResource;"); out.println(); diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleI1.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleI1.java index a8ccb7562..7c4c60c9c 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleI1.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleI1.java @@ -1,3 +1,23 @@ +/* + * Copyright Inrupt Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ package com.inrupt.rdf.wrapping.declarative.template; import org.apache.jena.query.Dataset; diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1.java index b84325c35..fd3a934b0 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1.java @@ -1,3 +1,23 @@ +/* + * Copyright Inrupt Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ package com.inrupt.rdf.wrapping.declarative.template; // @Resource diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1_$impl.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1_$impl.java index d6f7017d7..ebb82bb94 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1_$impl.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode1_$impl.java @@ -39,7 +39,7 @@ public class ExampleNode1_$impl extends WrapperResource implements ExampleNode1 { static final Implementation factory = new UriOrBlankFactory(ExampleNode1_$impl::new); - protected ExampleNode1_$impl(Node node, EnhGraph model) { + protected ExampleNode1_$impl(final Node node, final EnhGraph model) { super(node, model); } diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2.java index c8af94dff..46b31aa57 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2.java @@ -22,6 +22,9 @@ // @Resource public interface ExampleNode2 { - // @Property(predicate = "urn:example:p2", type = PropertyMappingTypes.anyOrNull, mapping = ValueMappingTypes.literalAsString) + // @Property( + // predicate = "urn:example:p2", + // type = PropertyMappingTypes.anyOrNull, + // mapping = ValueMappingTypes.literalAsString) String getP2(); } diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2_$impl.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2_$impl.java index 8e05db159..0a2b4eef8 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2_$impl.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/ExampleNode2_$impl.java @@ -39,7 +39,7 @@ public class ExampleNode2_$impl extends WrapperResource implements ExampleNode2 { static final Implementation factory = new UriOrBlankFactory(ExampleNode2_$impl::new); - protected ExampleNode2_$impl(Node node, EnhGraph model) { + protected ExampleNode2_$impl(final Node node, final EnhGraph model) { super(node, model); } diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/Manager.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/Manager.java index d225d2d3a..885516512 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/Manager.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/Manager.java @@ -27,7 +27,7 @@ import org.apache.jena.rdf.model.Model; /** - * A utility class that aids wrapper interfaces to find generated implementations + * A utility class that aids wrapper interfaces to find generated implementations. */ // TODO: Move to processor module // TODO: Should this be SPI? @@ -43,11 +43,11 @@ public static T wrap(final Class type, final Dataset original) { return wrap(type, original, Dataset.class); } - private static T wrap(final Class type, final Object original, Class xtype) { + private static T wrap(final Class type, final Object original, final Class xtype) { final ClassLoader classLoader = type.getClassLoader(); final String implTypeName = type.getName() + "_$impl"; - Class implClass; + final Class implClass; try { implClass = Class.forName(implTypeName, true, classLoader).asSubclass(type); } catch (ClassNotFoundException e) { diff --git a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/package-info.java b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/package-info.java index cb90dd82b..b70d996e4 100644 --- a/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/package-info.java +++ b/declarative/template/src/main/java/com/inrupt/rdf/wrapping/declarative/template/package-info.java @@ -20,6 +20,6 @@ */ /** - * Examples of wrapper interfaces and the implementations the Processor should generate from them + * Examples of wrapper interfaces and the implementations the Processor should generate from them. */ package com.inrupt.rdf.wrapping.declarative.template;