-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from mmnaseri/release-reflection-v1.0.0
Release reflection v1.0.0 $release:tuples4j-reflection$
- Loading branch information
Showing
102 changed files
with
6,804 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM ubuntu:bionic | ||
RUN apt-get update \ | ||
&& apt-get install openjdk-8-jdk -y --no-install-recommends \ | ||
&& apt-get install maven -y --no-install-recommends \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
VOLUME /src | ||
WORKDIR /src | ||
CMD "bash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,14 @@ | ||
= ROADMAP | ||
|
||
1. Add more tools to the library [**DONE**] | ||
a. We need supplier-based methods for all the mappings: | ||
- `one.extendWith(() -> new Random().nextInt())` | ||
- `one.first(UUID::randomUUID)` | ||
b. The above need to exposed statically as well: | ||
- `Tuple.extendOne(() -> null)` | ||
- `Tuple.mappingFirst(() -> null)` | ||
c. All `Has*` facades need to expose type-changing mappings: | ||
The reflection utility should also define a *scope* or *context* | ||
which is consulted by the registries and proxy creators to control | ||
caching. | ||
|
||
TwoTuple<Object, Integer, Integer> t1 = Tuple.of(1, 2); | ||
TwoTuple<Object, String, Integer> t2 = t1.changeFirst(Objects::toString); | ||
TwoTuple<Object, String, Double> t3 = t2.changeSecond(t1.first() * 1.0D); | ||
Currently, our caching applies to everything, and we cache per-type. | ||
|
||
d. The above methods will need to be exposed statically as well: | ||
This might not be desired in some situations, and a more fine-grained | ||
control over how scopes are defined can be useful. | ||
|
||
Tuple.changingFirst(Objects::toString) | ||
e. We might need to remove the `T` type from `FixedTuple` and instead use the | ||
generic `Tuple<Z>` with appropriate downstream type-tightening. | ||
2. Write tests for the main module. [**DONE**] | ||
3. Set up TravisCI build. [**DONE**] | ||
4. Write JavaDoc for the main module. [**DONE**] | ||
5. Write an illustrative README with appropriate badging. [**DONE**] | ||
6. Run the code through Codeacy and Coveralls. [**DONE**] | ||
7. Set up deployment via OSSRH. | ||
8. Implement the reflection utility. | ||
Ideally a scope or context should be hierarchical and allow for a parent-child | ||
relationship, so that we can have an application-level context, for instance, | ||
which is inherited and used by the request-level context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
# If the merge commit message for the pull request being merged into master contains the line '$release:....$' | ||
# the indicated module will be released into central. | ||
main() { | ||
if [[ -n $(echo "${TRAVIS_COMMIT_MESSAGE}" | grep -E '\$release:.+\$') ]]; then | ||
local target | ||
target="$(echo "${TRAVIS_COMMIT_MESSAGE}" | grep -E '\$release:.+\$' | sed -E 's/\$release:(.*)\$/\1/')" | ||
if [[ ! -d "../${target}" ]]; | ||
then | ||
echo "Cannot perform release on unknown target <${target}>" | ||
exit 1 | ||
fi | ||
cd "../${target}" || exit | ||
if [[ $TRAVIS_BRANCH == "master" ]]; then | ||
if [[ ("${TRAVIS_PULL_REQUEST}" == "false" || -z "${TRAVIS_PULL_REQUEST}") ]]; then | ||
if [[ "$(echo "${JAVA_HOME}" | grep -o 8)" == "8" ]]; then | ||
bash ../deployment/deploy.sh ab4567ade088 ../deployment/key.asc.enc ../deployment/settings.xml | ||
else | ||
echo "Not attempting to release ${target} since we are on JDK ${JAVA_HOME}" | ||
fi | ||
else | ||
echo "Not attempting to release ${target} since this is a pull request" | ||
fi | ||
else | ||
echo "Not attempting to release ${target} since this is the <${TRAVIS_BRANCH}> branch and not the <master> branch." | ||
fi | ||
else | ||
echo "Commit message does not match the pattern \$release:...\$. Ignoring release target." | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>tuples4j-build</artifactId> | ||
<groupId>com.mmnaseri.utils</groupId> | ||
<version>1.0.0</version> | ||
<relativePath>../tuples4j-build/pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>tuples4j-reflection</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<name>Tuples4J : Reflection</name> | ||
<description>Tools to effectively use tuples to represent class instances.</description> | ||
<url>https://mmnaseri.github.io/tuples4j</url> | ||
<inceptionYear>2020</inceptionYear> | ||
<licenses> | ||
<license> | ||
<name>MIT</name> | ||
<url>http://mit-license.org</url> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<name>Milad Naseri</name> | ||
<email>m.m.naseri@gmail.com</email> | ||
<url>http://www.mmnaseri.com</url> | ||
<roles> | ||
<role>designer</role> | ||
<role>developer</role> | ||
</roles> | ||
</developer> | ||
</developers> | ||
|
||
<scm> | ||
<connection>scm:git:git@github.com:mmnaseri/tuples4j.git</connection> | ||
<developerConnection>scm:git:git@github.com:mmnaseri/tuples4j.git</developerConnection> | ||
<url>git@github.com:mmnaseri/tuples4j.git</url> | ||
</scm> | ||
<issueManagement> | ||
<system>Github</system> | ||
<url>https://github.com/mmnaseri/tuples4j/issues</url> | ||
</issueManagement> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<testng.version>7.1.0</testng.version> | ||
<hamcrest.version>1.3</hamcrest.version> | ||
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version> | ||
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version> | ||
<!-- deployment --> | ||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version> | ||
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version> | ||
<maven-source-plugin.version>3.2.1</maven-source-plugin.version> | ||
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version> | ||
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version> | ||
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version> | ||
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version> | ||
<tuples4j.version>1.1.0</tuples4j.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>${testng.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>${hamcrest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.mmnaseri.utils</groupId> | ||
<artifactId>tuples4j</artifactId> | ||
<version>${tuples4j.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>release</id> | ||
<distributionManagement> | ||
<repository> | ||
<id>ossrh</id> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> | ||
</repository> | ||
<snapshotRepository> | ||
<id>ossrh</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
<build> | ||
<plugins> | ||
<!-- for signing the artifacts using the GPG signature --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-gpg-plugin</artifactId> | ||
<version>${maven-gpg-plugin.version}</version> | ||
<configuration> | ||
<!-- Must run with -Dgpg.passphrase=... to succeed --> | ||
<executable>gpg2</executable> | ||
<gpgArguments> | ||
<arg>--batch</arg> | ||
<arg>--pinentry-mode</arg> | ||
<arg>loopback</arg> | ||
</gpgArguments> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>sign-artifacts</id> | ||
<goals> | ||
<goal>sign</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- to generate javadoc JAR --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>${maven-javadoc-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- to generate sources JAR --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven-source-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- sets up the deployment --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>${maven-deploy-plugin.version}</version> | ||
<configuration> | ||
<repositoryId>ossrh</repositoryId> | ||
</configuration> | ||
</plugin> | ||
<!-- To do Nexus staging --> | ||
<plugin> | ||
<groupId>org.sonatype.plugins</groupId> | ||
<artifactId>nexus-staging-maven-plugin</artifactId> | ||
<version>${nexus-staging-maven-plugin.version}</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<serverId>ossrh</serverId> | ||
<nexusUrl>https://oss.sonatype.org/</nexusUrl> | ||
<autoReleaseAfterClose>true</autoReleaseAfterClose> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>coverage</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>${cobertura-maven-plugin.version}</version> | ||
<configuration> | ||
<format>xml</format> | ||
<maxmem>256m</maxmem> | ||
<!-- aggregated reports for multi-module projects --> | ||
<aggregate>true</aggregate> | ||
<check/> | ||
<instrumentation> | ||
<excludes> | ||
<exclude>com/mmnaseri/utils/tuples/reflection/impl/InterfaceDefaultMethodTupleInvocationHandler.java</exclude> | ||
</excludes> | ||
</instrumentation> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eluder.coveralls</groupId> | ||
<artifactId>coveralls-maven-plugin</artifactId> | ||
<version>${coveralls-maven-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>coverage-local</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>${cobertura-maven-plugin.version}</version> | ||
<configuration> | ||
<format>xml</format> | ||
<maxmem>256m</maxmem> | ||
<!-- aggregated reports for multi-module projects --> | ||
<aggregate>true</aggregate> | ||
<check/> | ||
<outputDirectory>target/reports</outputDirectory> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
tuples4j-reflection/src/main/java/com/mmnaseri/utils/tuples/ReflectiveLabeledTuple.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.mmnaseri.utils.tuples; | ||
|
||
/** | ||
* A {@link LabeledTuple} that can be used to reflectively instantiate objects with this tuple | ||
* acting as the backing data. | ||
* | ||
* @author Milad Naseri (m.m.naseri@gmail.com) | ||
* @see ReflectiveTuple | ||
*/ | ||
public interface ReflectiveLabeledTuple<Z> extends ReflectiveTuple<Z>, LabeledTuple<Z> {} |
Oops, something went wrong.