Skip to content

Commit

Permalink
Merge pull request #124 from dbmdz/manifestations-performance
Browse files Browse the repository at this point in the history
Manifestations performance
  • Loading branch information
daforster authored Jun 7, 2024
2 parents 15b7bcb + 37c6551 commit 4b0a996
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Fixed

- Increased performance of reflection by 32.8%

## [9.2.0](https://github.com/dbmdz/metadata-service/releases/tag/9.2.0) - 2024-06-03

### Added
Expand Down
2 changes: 1 addition & 1 deletion metasvc-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Client</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-lobid-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: lobid.org Client</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Model</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.slf4j.Logger;
Expand Down Expand Up @@ -41,22 +42,21 @@ public static <D extends Identifiable> D build(Identifiable identifiable, Class<
if (!identifiableGetter.getName().startsWith("get")) continue;
Type returnType = identifiableGetter.getGenericReturnType();
// ...find the corresponding setter of the new object...
Method[] setters =
String searchedSetter = "set" + identifiableGetter.getName().substring(3);
Optional<Method> setter =
derivedInstSetters.stream()
.filter(
derivSetter ->
derivSetter
.getName()
.equals(identifiableGetter.getName().replaceFirst("^get", "set"))
derivSetter.getName().equals(searchedSetter)
&& derivSetter.getParameterCount() == 1
&& derivSetter
.getParameters()[0]
.getParameterizedType()
.equals(returnType))
.toArray(i -> new Method[i]);
if (setters.length != 1) continue;
.findFirst();
if (setter.isEmpty()) continue;
// ...and invoke this setter with the getter's returned value
setters[0].invoke(derivedInst, identifiableGetter.invoke(identifiable));
setter.get().invoke(derivedInst, identifiableGetter.invoke(identifiable));
}
return derivedInst;
} catch (InstantiationException
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/backend-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Backend API)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/backend-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Backend IMPL File)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/backend-inmemory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Backend IMPL InMemory)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/backend-jdbi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Backend IMPL JDBI PostgreSql)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/backend-lobid/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Backend IMPL External System lobid.org)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/business/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Business)</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server</name>
Expand Down
2 changes: 1 addition & 1 deletion metasvc-server/webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc-server</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
</parent>

<name>Metadata-Service: Repository Server (Webapp)</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>io.github.dbmdz.metadata</groupId>
<artifactId>metasvc</artifactId>
<version>9.2.0</version>
<version>9.2.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Metadata-Service</name>
Expand Down

0 comments on commit 4b0a996

Please sign in to comment.