Skip to content

Commit

Permalink
finish Jena 5 move
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Berezovskyi <[email protected]>
  • Loading branch information
berezovskyi committed Aug 14, 2023
1 parent 1ec11af commit 632fbf4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -363,7 +363,7 @@ public static Object fromJenaResource(final Resource resource, Class<?> beanClas
if (mostConcreteResourceClass.isPresent()) {
beanClass = mostConcreteResourceClass.get();
}
final Object newInstance = beanClass.newInstance();
final Object newInstance = beanClass.getDeclaredConstructor().newInstance();
final Map<Class<?>, Map<String, Method>> classPropertyDefinitionsToSetMethods = new HashMap<>();
final Map<String,Object> visitedResources = new HashMap<>();
final HashSet<String> rdfTypes = new HashSet<>();
Expand Down Expand Up @@ -553,7 +553,7 @@ private static List<Object> createObjectResultList(Class<?> beanClass,
continue;
}
}
final Object newInstance = beanClass.newInstance();
final Object newInstance = beanClass.getDeclaredConstructor().newInstance();
final Map<String,Object> visitedResources = new HashMap<>();
final HashSet<String> rdfTypes = new HashSet<>();

Expand Down Expand Up @@ -912,7 +912,7 @@ else if (o.isResource())
Class<?> resourceClass = optionalResourceClass.isPresent()
? optionalResourceClass.get()
: setMethodComponentParameterClass;
final Object nestedBean = resourceClass.newInstance();
final Object nestedBean = resourceClass.getDeclaredConstructor().newInstance();
fromResource(classPropertyDefinitionsToSetMethods,
nestedBean.getClass(),
nestedBean,
Expand All @@ -930,7 +930,7 @@ else if (o.isResource())
{
// This property supports reified statements. Create the
// new resource to hold the value and any metadata.
final Object reifiedResource = reifiedClass.newInstance();
final Object reifiedResource = reifiedClass.getDeclaredConstructor().newInstance();

// Find a setter for the actual value.
for (Method method : reifiedClass.getMethods())
Expand Down Expand Up @@ -1051,7 +1051,7 @@ else if ((SortedSet.class == parameterClass) ||
// Not handled above. Let's try newInstance with possible failure.
else
{
collection = ((Collection<Object>) parameterClass.newInstance());
collection = ((Collection<Object>) parameterClass.getDeclaredConstructor().newInstance());
}

collection.addAll(values);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -14,32 +14,30 @@

package org.eclipse.lyo.oslc4j.provider.jena;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.xml.datatype.DatatypeConfigurationException;

import com.google.common.collect.ImmutableList;
import org.apache.jena.datatypes.DatatypeFormatException;
import org.apache.jena.ext.com.google.common.collect.ImmutableList;
import org.apache.jena.rdf.model.Model;
import org.eclipse.lyo.oslc4j.core.OSLC4JConstants;
import org.eclipse.lyo.oslc4j.core.exception.LyoModelException;
import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException;
import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
import org.eclipse.lyo.oslc4j.provider.jena.helpers.RDFHelper;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Container;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Dog;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Element;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Person;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Pet;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.Assert.*;
import static org.eclipse.lyo.oslc4j.provider.jena.helpers.JenaAssert.*;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Animal;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Dog;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Person;
import org.eclipse.lyo.oslc4j.provider.jena.resources.Pet;
import javax.xml.datatype.DatatypeConfigurationException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;

import static org.eclipse.lyo.oslc4j.provider.jena.helpers.JenaAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
*
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@
<version>20100527</version>
</dependency>
<!-- https://app.snyk.io/vuln/SNYK-JAVA-ORGAPACHETOMCATEMBED-1080637 -->
<!-- TODO: Tomcat 8.5.x will reach End-of-life (EOL) on 31 March 2024. -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
Expand Down

0 comments on commit 632fbf4

Please sign in to comment.