├── .appveyor.yml ├── .gitbugtraq ├── .gitignore ├── .idea ├── .gitignore ├── copyright │ └── Apache_2_0.xml ├── encodings.xml ├── externalDependencies.xml ├── kotlinScripting.xml ├── kotlinc.xml └── vcs.xml ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.gradle.kts ├── docs ├── EXTRA.md ├── Q-and-A.md ├── USAGE.md └── UniListsBenchmark-results.txt ├── gradle.properties ├── gradle ├── LICENSE_HEADER └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lombok.config ├── settings.gradle.kts └── subprojects ├── api ├── pl.tlinkowski.unij.api │ ├── pl.tlinkowski.unij.api.gradle.kts │ └── src │ │ ├── jmh │ │ └── java │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── api │ │ │ └── UniListsBenchmark.java │ │ ├── main │ │ └── java │ │ │ ├── module-info.java │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── api │ │ │ ├── UniCollectors.java │ │ │ ├── UniJ.java │ │ │ ├── UniJException.java │ │ │ ├── UniJLoader.java │ │ │ ├── UniLists.java │ │ │ ├── UniMaps.java │ │ │ ├── UniSets.java │ │ │ └── package-info.java │ │ └── test │ │ ├── groovy │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── api │ │ │ ├── UniCollectorsSpec.groovy │ │ │ ├── UniJLoaderSpec.groovy │ │ │ ├── UniListsSpec.groovy │ │ │ ├── UniMapsSpec.groovy │ │ │ └── UniSetsSpec.groovy │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── pl.tlinkowski.unij.api.UniJLoaderSpec$DifferentPriorityService │ │ ├── pl.tlinkowski.unij.api.UniJLoaderSpec$DuplicatePriorityService │ │ └── pl.tlinkowski.unij.api.UniJLoaderSpec$UnannotatedService └── pl.tlinkowski.unij.service.api │ ├── pl.tlinkowski.unij.service.api.gradle.kts │ └── src │ └── main │ └── java │ ├── module-info.java │ └── pl │ └── tlinkowski │ └── unij │ └── service │ └── api │ ├── UniJService.java │ ├── collect │ ├── UnmodifiableListFactory.java │ ├── UnmodifiableMapFactory.java │ ├── UnmodifiableSetFactory.java │ └── package-info.java │ ├── misc │ ├── MiscellaneousApiProvider.java │ └── package-info.java │ └── package-info.java ├── bindings ├── collect │ ├── pl.tlinkowski.unij.service.collect.eclipse │ │ ├── pl.tlinkowski.unij.service.collect.eclipse.gradle.kts │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ ├── module-info.java │ │ │ │ └── pl │ │ │ │ └── tlinkowski │ │ │ │ └── unij │ │ │ │ └── service │ │ │ │ └── collect │ │ │ │ └── eclipse │ │ │ │ ├── EclipseUnmodifiableListFactory.java │ │ │ │ ├── EclipseUnmodifiableMapFactory.java │ │ │ │ ├── EclipseUnmodifiableSetFactory.java │ │ │ │ └── package-info.java │ │ │ └── test │ │ │ └── groovy │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── service │ │ │ └── collect │ │ │ └── eclipse │ │ │ ├── EclipseUnmodifiableListFactorySpec.groovy │ │ │ ├── EclipseUnmodifiableMapFactorySpec.groovy │ │ │ └── EclipseUnmodifiableSetFactorySpec.groovy │ ├── pl.tlinkowski.unij.service.collect.guava │ │ ├── pl.tlinkowski.unij.service.collect.guava.gradle.kts │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ ├── module-info.java │ │ │ │ └── pl │ │ │ │ └── tlinkowski │ │ │ │ └── unij │ │ │ │ └── service │ │ │ │ └── collect │ │ │ │ └── guava │ │ │ │ ├── GuavaUnmodifiableListFactory.java │ │ │ │ ├── GuavaUnmodifiableMapFactory.java │ │ │ │ ├── GuavaUnmodifiableSetFactory.java │ │ │ │ └── package-info.java │ │ │ └── test │ │ │ └── groovy │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── service │ │ │ └── collect │ │ │ └── guava │ │ │ ├── GuavaUnmodifiableListFactorySpec.groovy │ │ │ ├── GuavaUnmodifiableMapFactorySpec.groovy │ │ │ └── GuavaUnmodifiableSetFactorySpec.groovy │ ├── pl.tlinkowski.unij.service.collect.jdk10 │ │ ├── pl.tlinkowski.unij.service.collect.jdk10.gradle.kts │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ ├── module-info.java │ │ │ │ └── pl │ │ │ │ └── tlinkowski │ │ │ │ └── unij │ │ │ │ └── service │ │ │ │ └── collect │ │ │ │ └── jdk10 │ │ │ │ ├── Jdk10UnmodifiableListFactory.java │ │ │ │ ├── Jdk10UnmodifiableMapFactory.java │ │ │ │ ├── Jdk10UnmodifiableSetFactory.java │ │ │ │ └── package-info.java │ │ │ └── test │ │ │ └── groovy │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── service │ │ │ └── collect │ │ │ └── jdk10 │ │ │ ├── Jdk10UnmodifiableListFactorySpec.groovy │ │ │ ├── Jdk10UnmodifiableMapFactorySpec.groovy │ │ │ └── Jdk10UnmodifiableSetFactorySpec.groovy │ └── pl.tlinkowski.unij.service.collect.jdk8 │ │ ├── pl.tlinkowski.unij.service.collect.jdk8.gradle.kts │ │ └── src │ │ ├── main │ │ └── java │ │ │ ├── module-info.java │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── service │ │ │ └── collect │ │ │ └── jdk8 │ │ │ ├── Jdk8UnmodifiableListFactory.java │ │ │ ├── Jdk8UnmodifiableMapFactory.java │ │ │ ├── Jdk8UnmodifiableSetFactory.java │ │ │ └── package-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── service │ │ └── collect │ │ └── jdk8 │ │ ├── Jdk8UnmodifiableListFactorySpec.groovy │ │ ├── Jdk8UnmodifiableMapFactorySpec.groovy │ │ └── Jdk8UnmodifiableSetFactorySpec.groovy └── misc │ ├── pl.tlinkowski.unij.service.misc.jdk11 │ ├── pl.tlinkowski.unij.service.misc.jdk11.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ ├── module-info.java │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── service │ │ │ └── misc │ │ │ └── jdk11 │ │ │ ├── Jdk11MiscellaneousApiProvider.java │ │ │ └── package-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── service │ │ └── misc │ │ └── jdk11 │ │ └── Jdk11MiscellaneousApiProviderSpec.groovy │ └── pl.tlinkowski.unij.service.misc.jdk8 │ ├── pl.tlinkowski.unij.service.misc.jdk8.gradle.kts │ └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── service │ │ └── misc │ │ └── jdk8 │ │ ├── Jdk8MiscellaneousApiProvider.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── service │ └── misc │ └── jdk8 │ └── Jdk8MiscellaneousApiProviderSpec.groovy ├── bundles ├── pl.tlinkowski.unij.bundle.eclipse_jdk8 │ ├── pl.tlinkowski.unij.bundle.eclipse_jdk8.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── module-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── bundle │ │ └── eclipse_jdk8 │ │ └── EclipseJdk8BundleTest.groovy ├── pl.tlinkowski.unij.bundle.guava_jdk8 │ ├── pl.tlinkowski.unij.bundle.guava_jdk8.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── module-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── bundle │ │ └── guava_jdk8 │ │ └── GuavaJdk8BundleTest.groovy ├── pl.tlinkowski.unij.bundle.jdk11 │ ├── pl.tlinkowski.unij.bundle.jdk11.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── module-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── bundle │ │ └── jdk11 │ │ └── Jdk11BundleTest.groovy └── pl.tlinkowski.unij.bundle.jdk8 │ ├── pl.tlinkowski.unij.bundle.jdk8.gradle.kts │ └── src │ ├── main │ └── java │ │ └── module-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── bundle │ └── jdk8 │ └── Jdk8BundleTest.groovy ├── pl.tlinkowski.unij.test ├── pl.tlinkowski.unij.test.gradle.kts └── src │ └── main │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── test │ ├── bundle │ ├── UniJBundleTest.groovy │ └── package-info.java │ └── service │ ├── collect │ ├── UnmodifiableCollectionSpecHelper.groovy │ ├── UnmodifiableListFactorySpec.groovy │ ├── UnmodifiableMapFactorySpec.groovy │ ├── UnmodifiableMapSpecHelper.groovy │ ├── UnmodifiableSetFactorySpec.groovy │ └── package-info.java │ └── misc │ └── MiscellaneousApiProviderSpec.groovy └── samples ├── enduser ├── pl.tlinkowski.unij.sample.enduser.jdk11 │ ├── pl.tlinkowski.unij.sample.enduser.jdk11.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ ├── module-info.java │ │ │ └── pl │ │ │ └── tlinkowski │ │ │ └── unij │ │ │ └── sample │ │ │ └── enduser │ │ │ └── jdk11 │ │ │ ├── EndUsage.java │ │ │ └── package-info.java │ │ └── test │ │ └── groovy │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── enduser │ │ └── jdk11 │ │ └── EndUsageSpec.groovy └── pl.tlinkowski.unij.sample.enduser.jdk8 │ ├── pl.tlinkowski.unij.sample.enduser.jdk8.gradle.kts │ └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── enduser │ │ └── jdk8 │ │ ├── EndUsage.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── enduser │ └── jdk8 │ └── EndUsageSpec.groovy └── lib ├── pl.tlinkowski.unij.sample.lib.usage.eclipse ├── pl.tlinkowski.unij.sample.lib.usage.eclipse.gradle.kts └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── lib │ │ └── usage │ │ └── eclipse │ │ ├── SampleLogicMain.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── lib │ └── usage │ └── eclipse │ └── SampleLogicSpec.groovy ├── pl.tlinkowski.unij.sample.lib.usage.guava ├── pl.tlinkowski.unij.sample.lib.usage.guava.gradle.kts └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── lib │ │ └── usage │ │ └── guava │ │ ├── SampleLogicMain.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── lib │ └── usage │ └── guava │ └── SampleLogicSpec.groovy ├── pl.tlinkowski.unij.sample.lib.usage.jdk11 ├── pl.tlinkowski.unij.sample.lib.usage.jdk11.gradle.kts └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── lib │ │ └── usage │ │ └── jdk11 │ │ ├── SampleLogicMain.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── lib │ └── usage │ └── jdk11 │ └── SampleLogicSpec.groovy ├── pl.tlinkowski.unij.sample.lib.usage.jdk8 ├── pl.tlinkowski.unij.sample.lib.usage.jdk8.gradle.kts └── src │ ├── main │ └── java │ │ ├── module-info.java │ │ └── pl │ │ └── tlinkowski │ │ └── unij │ │ └── sample │ │ └── lib │ │ └── usage │ │ └── jdk8 │ │ ├── SampleLogicMain.java │ │ └── package-info.java │ └── test │ └── groovy │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── lib │ └── usage │ └── jdk8 │ └── SampleLogicSpec.groovy └── pl.tlinkowski.unij.sample.lib ├── pl.tlinkowski.unij.sample.lib.gradle.kts └── src ├── main └── java │ ├── module-info.java │ └── pl │ └── tlinkowski │ └── unij │ └── sample │ └── lib │ ├── SampleLogic.java │ └── package-info.java └── test └── groovy └── pl └── tlinkowski └── unij └── sample └── lib └── SampleLogicSpec.groovy /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # reference: https://www.appveyor.com/docs/appveyor-yml/ 2 | 3 | image: Visual Studio 2017 # https://www.appveyor.com/docs/windows-images-software/ 4 | 5 | version: "#{build} ({branch})" 6 | 7 | branches: 8 | except: 9 | - /^\d+\.\d+\.\d+$/ # skip builds related to addTemporaryVersionTag 10 | 11 | #region JAVA 12 | environment: 13 | matrix: 14 | - JAVA_HOME: C:\Program Files\Java\jdk12 15 | 16 | install: 17 | - SET PATH=%JAVA_HOME%\bin;%PATH 18 | - java --version 19 | #endregion 20 | 21 | #region GRADLE 22 | build_script: 23 | - gradlew.bat assemble 24 | 25 | test_script: 26 | - gradlew.bat check --stacktrace 27 | 28 | cache: 29 | - C:\Users\appveyor\.gradle 30 | 31 | on_finish: 32 | # upload test results via REST-api: https://github.com/appveyor/ci/issues/92#issuecomment-307242316 33 | - ps: | 34 | $wc = New-Object 'System.Net.WebClient' 35 | Get-ChildItem . -Name -Recurse 'TEST-*.xml' | 36 | Foreach-Object { 37 | $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $_)) 38 | } 39 | #endregion 40 | -------------------------------------------------------------------------------- /.gitbugtraq: -------------------------------------------------------------------------------- 1 | [bugtraq] 2 | url = https://github.com/tlinkowski/UniJ/issues/%BUGID% 3 | loglinkregex = "#\\d+" 4 | logregex = \\d+ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # 26 | # Gradle 27 | # 28 | .gradle 29 | build/ 30 | 31 | # Ignore Gradle GUI config 32 | gradle-app.setting 33 | 34 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 35 | !gradle-wrapper.jar 36 | 37 | # 38 | # IntelliJ 39 | # 40 | *.iml 41 | 42 | # 43 | # Node.js 44 | # 45 | /node_modules/ 46 | /package-lock.json 47 | 48 | # 49 | # SuperPOM 50 | # 51 | /.grenrc.yml 52 | /package.json 53 | /release.bat 54 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore 2 | 3 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 4 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 5 | 6 | # User-specific stuff 7 | /workspace.xml 8 | /tasks.xml 9 | /usage.statistics.xml 10 | /dictionaries 11 | /shelf 12 | 13 | # Generated files 14 | /contentModel.xml 15 | 16 | # Sensitive or high-churn files 17 | /dataSources/ 18 | /dataSources.ids 19 | /dataSources.local.xml 20 | /sqlDataSources.xml 21 | /dynamic.xml 22 | /uiDesigner.xml 23 | /dbnavigator.xml 24 | 25 | # Gradle 26 | /gradle.xml 27 | /libraries 28 | 29 | # Gradle and Maven with auto-import 30 | # When using Gradle or Maven with auto-import, you should exclude module files, 31 | # since they will be recreated, and may cause churn. Uncomment if using 32 | # auto-import. 33 | /modules.xml 34 | /*.iml 35 | /modules 36 | 37 | # IntelliJ 38 | out/ 39 | 40 | # Other 41 | /compiler.xml 42 | /misc.xml 43 | 44 | # SuperPOM 45 | /codeStyles/ 46 | /copyright/profiles_settings.xml 47 | /inspectionProfiles/ 48 | -------------------------------------------------------------------------------- /.idea/copyright/Apache_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/externalDependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/kotlinScripting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: openjdk12 3 | 4 | sudo: false # faster builds 5 | 6 | branches: 7 | except: 8 | - /^\d+\.\d+\.\d+$/ # skip builds related to addTemporaryVersionTag 9 | 10 | before_install: 11 | - chmod +x gradlew # https://stackoverflow.com/questions/33820638/travis-yml-gradlew-permission-denied/33820642#33820642 12 | - pip install --user codecov # https://github.com/codecov/codecov-python#configuration 13 | 14 | #region https://docs.travis-ci.com/user/languages/java/#caching 15 | before_cache: 16 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 17 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 18 | cache: 19 | directories: 20 | - $HOME/.gradle/caches/ 21 | - $HOME/.gradle/wrapper/ 22 | #endregion 23 | 24 | script: 25 | - ./gradlew check --stacktrace 26 | 27 | after_success: 28 | - codecov # https://github.com/codecov/codecov-python#configuration 29 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Releases 2 | 3 | ## Version 0.1.3 4 | 5 | Release date: 28/01/2021. 6 | 7 | ### Bug Fixes 8 | 9 | - [#55](https://github.com/tlinkowski/UniJ/issues/55): Strange error - 52 vs 53 when run on GitHub Actions 10 | 11 | --- 12 | 13 | ## Version 0.1.1 14 | 15 | Release date: 16/09/2019. 16 | 17 | ### Bug Fixes 18 | 19 | - [#53](https://github.com/tlinkowski/UniJ/issues/53): Can't sync to Maven Central 20 | 21 | --- 22 | 23 | ## Version 0.1.0 24 | 25 | Release date: 15/09/2019. 26 | 27 | ### Enhancements 28 | 29 | - [#51](https://github.com/tlinkowski/UniJ/issues/51): Add sample projects 30 | - [#50](https://github.com/tlinkowski/UniJ/issues/50): Update `pl.tlinkowski.annotation.basic` to 0.2.0 31 | - [#49](https://github.com/tlinkowski/UniJ/issues/49): Update `pl.tlinkowski.gradle.my.superpom` to 0.3.0 32 | - [#48](https://github.com/tlinkowski/UniJ/issues/48): Change artifact names to module names 33 | - [#47](https://github.com/tlinkowski/UniJ/issues/47): [unij-test] Tighten the Spock specs 34 | - [#43](https://github.com/tlinkowski/UniJ/issues/43): Enable Bintray for all subprojects 35 | - [#41](https://github.com/tlinkowski/UniJ/issues/41): Improve `unij-service-api` project to export everything under `pl.tlinkowski.unij.service.api` package 36 | - [#39](https://github.com/tlinkowski/UniJ/issues/39): Extract common `unij-bundle-*` and `unij-(collect|misc)-*` configurations to `build.gradle.kts` 37 | - [#37](https://github.com/tlinkowski/UniJ/issues/37): Apply java-library plugin in all subprojects 38 | - [#36](https://github.com/tlinkowski/UniJ/issues/36): Extract unij-service-api project 39 | - [#35](https://github.com/tlinkowski/UniJ/issues/35): Add dependency on basic-annotations 40 | - [#34](https://github.com/tlinkowski/UniJ/issues/34): Use Google's @AutoService for generating META-INF/services 41 | - [#33](https://github.com/tlinkowski/UniJ/issues/33): Apply Kordamp settings plugin 42 | - [#32](https://github.com/tlinkowski/UniJ/issues/32): Introduce "bundle" modules 43 | - [#31](https://github.com/tlinkowski/UniJ/issues/31): Architecture improvements 44 | - [#30](https://github.com/tlinkowski/UniJ/issues/30): Support logging facade & log which services get loaded by UniJ 45 | - [#29](https://github.com/tlinkowski/UniJ/issues/29): Configure code quality reporting 46 | - [#28](https://github.com/tlinkowski/UniJ/issues/28): Implement unij-misc-jdk8 module 47 | - [#27](https://github.com/tlinkowski/UniJ/issues/27): Implement unij-collect-jdk8 module 48 | - [#26](https://github.com/tlinkowski/UniJ/issues/26): Implement unij-collect-eclipse module 49 | - [#25](https://github.com/tlinkowski/UniJ/issues/25): Implement unij-collect-guava module 50 | - [#24](https://github.com/tlinkowski/UniJ/issues/24): Create MiscellaneousApiProvider and related classes 51 | - [#23](https://github.com/tlinkowski/UniJ/issues/23): Create UnmodifiableMapFactory and related classes 52 | - [#22](https://github.com/tlinkowski/UniJ/issues/22): Create UnmodifiableSetFactory and related classes 53 | - [#21](https://github.com/tlinkowski/UniJ/issues/21): Support loading priority for UniJ services 54 | - [#20](https://github.com/tlinkowski/UniJ/issues/20): Configure Javadoc generation to link external Javadocs 55 | - [#18](https://github.com/tlinkowski/UniJ/issues/18): Create UniJ service loading class 56 | - [#17](https://github.com/tlinkowski/UniJ/issues/17): Create public static UniLists and UniCollectors 57 | - [#16](https://github.com/tlinkowski/UniJ/issues/16): Create UnmodifiableListFactory and related classes 58 | - [#14](https://github.com/tlinkowski/UniJ/issues/14): Add a Gradle plugin for project details 59 | - [#13](https://github.com/tlinkowski/UniJ/issues/13): Create a JMH benchmark for direct calls vs UniJ calls 60 | - [#12](https://github.com/tlinkowski/UniJ/issues/12): Introduce JPMS modules 61 | - [#11](https://github.com/tlinkowski/UniJ/issues/11): Update README.md 62 | - [#10](https://github.com/tlinkowski/UniJ/issues/10): Configure Travis CI 63 | - [#9](https://github.com/tlinkowski/UniJ/issues/9): Add IntelliJ configuration 64 | - [#7](https://github.com/tlinkowski/UniJ/issues/7): Configure code coverage reporting 65 | - [#6](https://github.com/tlinkowski/UniJ/issues/6): Configure publishing in Gradle 66 | - [#5](https://github.com/tlinkowski/UniJ/issues/5): Configure releasing in Gradle 67 | - [#3](https://github.com/tlinkowski/UniJ/issues/3): Update Gradle to 5.2.1 68 | - [#1](https://github.com/tlinkowski/UniJ/issues/1): Add initial Gradle configuration 69 | 70 | ### Bug Fixes 71 | 72 | - [#42](https://github.com/tlinkowski/UniJ/issues/42): Fix `module-info.java` for `unij-bundle-*` 73 | - [#38](https://github.com/tlinkowski/UniJ/issues/38): The code being documented uses modules but the packages defined in [...] are in the unnamed module 74 | -------------------------------------------------------------------------------- /docs/EXTRA.md: -------------------------------------------------------------------------------- 1 | # UniJ: Extra Information 2 | 3 | ← back to [UniJ README](../README.md) 4 | 5 | Table of Contents: 6 | 7 | - [Project Layout](#project-layout) 8 | - [Performance](#performance) 9 | - [Kotlin Interoperability](#kotlin-interoperability) 10 | - [Backport of Java 9+ to Java 8](#backport-of-java-9-to-java-8) 11 | 12 | ## Project Layout 13 | 14 | - [API](../README.md#API): 15 | - [`pl.tlinkowski.unij.api`](../subprojects/api/pl.tlinkowski.unij.api) 16 | - [`pl.tlinkowski.unij.service.api`](../subprojects/api/pl.tlinkowski.unij.service.api) 17 | 18 | - [bindings](../README.md#bindings): 19 | - `Collection` factories: 20 | - [`pl.tlinkowski.unij.service.collect.jdk8`](../subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8) 21 | - [`pl.tlinkowski.unij.service.collect.jdk10`](../subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10) 22 | - [`pl.tlinkowski.unij.service.collect.guava`](../subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava) 23 | - [`pl.tlinkowski.unij.service.collect.eclipse`](../subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse) 24 | - miscellaneous: 25 | - [`pl.tlinkowski.unij.service.misc.jdk8`](../subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8) 26 | - [`pl.tlinkowski.unij.service.misc.jdk11`](../subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11) 27 | 28 | - [bundles](../README.md#bundles): 29 | - [`pl.tlinkowski.unij.bundle.jdk8`](../subprojects/bundles/pl.tlinkowski.unij.bundle.jdk8) 30 | - [`pl.tlinkowski.unij.bundle.jdk11`](../subprojects/bundles/pl.tlinkowski.unij.bundle.jdk11) 31 | - [`pl.tlinkowski.unij.bundle.guava_jdk8`](../subprojects/bundles/pl.tlinkowski.unij.bundle.guava_jdk8) 32 | - [`pl.tlinkowski.unij.bundle.eclipse_jdk8`](../subprojects/bundles/pl.tlinkowski.unij.bundle.eclipse_jdk8) 33 | 34 | - [`pl.tlinkowski.unij.test`](../subprojects/pl.tlinkowski.unij.test) 35 | (for [custom bindings](../README.md#custom-bindings)) 36 | 37 | ## Performance 38 | 39 | If you wonder how UniJ's indirection (= its two extra layers: [User API](../README.md#user-api) 40 | and [Service API](../README.md#service-api)) affects performance, the answer is short: **it effectively doesn't**. 41 | 42 | It turns out the JIT compiler simply optimizes all the indirection away. 43 | 44 | You can verify this by running a JMH benchmark 45 | ([`UniListsBenchmark`](../subprojects/api/pl.tlinkowski.unij.api/src/jmh/java/pl/tlinkowski/unij/api/UniListsBenchmark.java)) 46 | where calls to `UniLists` (with a JDK 11 binding) are compared to direct JDK 11 API calls. The exact results can be 47 | found [here](UniListsBenchmark-results.txt). 48 | 49 | ## Kotlin Interoperability 50 | 51 | This library is highly interoperable with [Kotlin](https://kotlinlang.org/) thanks to being annotated with regard to: 52 | 53 | - nullability ([`@NonNullPackage`](https://github.com/tlinkowski/basic-annotations/blob/master/subprojects/pl.tlinkowski.annotation.basic/src/main/java/pl/tlinkowski/annotation/basic/NonNullPackage.java)) 54 | - mutability ([`@ReadOnly`](https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-annotations-jvm/src/kotlin/annotations/jvm/ReadOnly.java)) 55 | 56 | using annotations provided by [Basic Java Annotations](https://github.com/tlinkowski/basic-annotations) library. 57 | 58 | ## Backport of Java 9+ to Java 8 59 | 60 | If you're looking for a backport of Java 9+ to Java 8, you can use the following for: 61 | 62 | 1. new **APIs**: [UniJ](http://unij.tlinkowski.pl) 63 | 64 | - UniJ JDK 8 bundle ([`pl.tlinkowski.unij.bundle.jdk8`](../subprojects/bundles/pl.tlinkowski.unij.bundle.jdk8)) 65 | is *effectively* a backport of **some** of the JDK 9+ APIs to JDK 8 66 | (see [End Users Stuck on JDK 8](../README.md#end-users-stuck-on-jdk-8) for details) 67 | 68 | 2. new **language features**: [Jabel](https://github.com/bsideup/jabel) 69 | 70 | - Jabel is an annotation processor that lets you use **some** language features of Java 9+ 71 | while still targeting JDK 8 72 | 73 | 3. **Java Platform Module System**: [Gradle Modules Plugin](https://github.com/java9-modularity/gradle-modules-plugin) 74 | 75 | - Gradle Modules Plugin provides support for JPMS (`module-info.java`) not only to JDK 9+ projects (standard mode) 76 | but also to JDK 8 projects (special 77 | [mixed mode](https://github.com/java9-modularity/gradle-modules-plugin#compilation-to-a-specific-java-release)) 78 | 79 | Together, UniJ, Jabel, and Gradle Modules Plugin may provide you with pretty good "Java 9+"-like experience 80 | while still targeting / being on JDK 8. 81 | 82 | --- 83 | 84 | ← back to [UniJ README](../README.md) 85 | -------------------------------------------------------------------------------- /docs/UniListsBenchmark-results.txt: -------------------------------------------------------------------------------- 1 | # VM version: JDK 11.0.1, OpenJDK 64-Bit Server VM, 11.0.1+13 2 | # Warmup: 5 iterations, 10 s each 3 | # Measurement: 5 iterations, 10 s each 4 | 5 | Benchmark Mode Cnt Score Error Units 6 | 7 | UniListsBenchmark.listOf avgt 25 3,690 ± 0,243 ns/op 8 | UniListsBenchmark.uniListsOf avgt 25 3,880 ± 0,176 ns/op 9 | 10 | UniListsBenchmark.listOf1 avgt 25 5,527 ± 0,073 ns/op 11 | UniListsBenchmark.uniListsOf1 avgt 25 6,259 ± 0,139 ns/op 12 | 13 | UniListsBenchmark.listOf2 avgt 25 5,982 ± 0,034 ns/op 14 | UniListsBenchmark.uniListsOf2 avgt 25 6,944 ± 0,442 ns/op 15 | 16 | UniListsBenchmark.listOf3 avgt 25 14,634 ± 0,059 ns/op 17 | UniListsBenchmark.uniListsOf3 avgt 25 16,273 ± 0,173 ns/op 18 | 19 | UniListsBenchmark.listOf10 avgt 25 39,240 ± 0,153 ns/op 20 | UniListsBenchmark.uniListsOf10 avgt 25 38,438 ± 0,104 ns/op 21 | 22 | UniListsBenchmark.listOf20 avgt 25 74,388 ± 0,226 ns/op 23 | UniListsBenchmark.uniListsOf20 avgt 25 71,040 ± 0,209 ns/op 24 | 25 | # Run complete. Total time: 01:40:40 -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | # Copyright 2018-2019 Tomasz Linkowski. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | group=pl.tlinkowski.unij 19 | # Release scopes: [major, minor, patch] 20 | reckon.scope=patch 21 | # Dependencies 22 | mySuperpomVersion=0.5.0 23 | basicAnnotationsVersion=0.2.0 24 | slf4jVersion=1.7.28 25 | autoServiceVersion=1.0-rc6 26 | guavaLowVersion=23.2-jre 27 | guavaHighVersion=28.1-jre 28 | eclipseCollectionsLowVersion=9.0.0 29 | eclipseCollectionsHighVersion=10.0.0 30 | -------------------------------------------------------------------------------- /gradle/LICENSE_HEADER: -------------------------------------------------------------------------------- 1 | SPDX-License-Identifier: Apache-2.0 2 | 3 | Copyright ${copyrightYear} ${author}. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlinkowski/UniJ/f95984072419b3a60cc20aef5bd1b0b0ceb33dc0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | # 2 | # https://projectlombok.org/features/configuration 3 | # 4 | 5 | ## Tell the configuration system it should stop looking for other configuration files (default: false). 6 | config.stopBubbling = true 7 | 8 | ## Generate getters and setters using only the field name (no get/set prefix) (default: false). 9 | lombok.accessors.fluent = true 10 | 11 | ## Copy these annotations to getters, setters, withers, builder-setters, etc. 12 | ## (source: https://github.com/tlinkowski/basic-annotations) 13 | lombok.copyableAnnotations += kotlin.annotations.jvm.ReadOnly 14 | lombok.copyableAnnotations += kotlin.annotations.jvm.Mutable 15 | lombok.copyableAnnotations += pl.tlinkowski.annotation.basic.NullOr 16 | 17 | ## Generate @lombok.Generated on all generated code (default: false). 18 | lombok.addLombokGeneratedAnnotation = true 19 | 20 | ## Generate a private no-args constructor for @Data and @Value (default: true). 21 | # lombok.noArgsConstructor.extraPrivate = [false | true] 22 | 23 | ## When generating equals and hashCode for classes that extend something (other than Object), either automatically take 24 | ## into account superclass implementation (call), or don't (skip), or warn and don't (warn). (default = warn). 25 | # lombok.equalsAndHashCode.callSuper = [CALL | SKIP | WARN] 26 | 27 | ## When generating toString for classes that extend something (other than Object), either automatically take 28 | ## into account superclass implementation (call), or don't (skip), or warn and don't (warn). (default = warn). 29 | # lombok.toString.callSuper = [CALL | SKIP | WARN] 30 | 31 | ## Include the field names in the generated toString method (default = true). 32 | # lombok.toString.includeFieldNames = [false | true] 33 | 34 | # 35 | # FLAG USAGE 36 | # 37 | 38 | ## Emit a warning or error if @Cleanup is used. 39 | lombok.cleanup.flagUsage = ERROR 40 | 41 | ## Emit a warning or error if @Delegate is used. 42 | lombok.delegate.flagUsage = ERROR 43 | 44 | ## Emit a warning or error if @ExtensionMethod is used. 45 | lombok.extensionMethod.flagUsage = ERROR 46 | 47 | ## Emit a warning or error if @FieldDefaults is used. 48 | lombok.fieldDefaults.flagUsage = ERROR 49 | 50 | ## Emit a warning or error if @Helper is used. 51 | lombok.helper.flagUsage = ERROR 52 | 53 | ## Emit a warning or error if @CommonsLog is used. 54 | lombok.log.apacheCommons.flagUsage = ERROR 55 | 56 | ## Emit a warning or error if @Flogger is used. 57 | lombok.log.flogger.flagUsage = ERROR 58 | 59 | ## Emit a warning or error if @Log is used. 60 | lombok.log.javaUtilLogging.flagUsage = ERROR 61 | 62 | ## Emit a warning or error if @JBossLog is used. 63 | lombok.log.jbosslog.flagUsage = ERROR 64 | 65 | ## Emit a warning or error if @Log4j is used. 66 | lombok.log.log4j.flagUsage = ERROR 67 | 68 | ## Emit a warning or error if @Log4j2 is used. 69 | lombok.log.log4j2.flagUsage = ERROR 70 | 71 | ## Emit a warning or error if @Synchronized is used. 72 | lombok.synchronized.flagUsage = ERROR 73 | 74 | ## Emit a warning or error if 'var' is used. 75 | lombok.var.flagUsage = ERROR 76 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | buildscript { 19 | repositories { 20 | mavenCentral() 21 | } 22 | dependencies { 23 | val mySuperpomVersion: String by settings // https://github.com/tlinkowski/tlinkowski-superpom 24 | classpath(group = "pl.tlinkowski.gradle.my", name = "pl.tlinkowski.gradle.my.settings", version = mySuperpomVersion) 25 | } 26 | } 27 | apply(plugin = "pl.tlinkowski.gradle.my.settings") 28 | 29 | rootProject.name = "UniJ" 30 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/pl.tlinkowski.unij.api.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | superpom.useLombok = true 21 | 22 | dependencies { 23 | val slf4jVersion: String by project // https://www.slf4j.org/ 24 | 25 | implementation(project(":pl.tlinkowski.unij.service.api")) 26 | implementation(group = "org.slf4j", name = "slf4j-api", version = slf4jVersion) 27 | 28 | testImplementation(project(":pl.tlinkowski.unij.test")) 29 | testRuntimeOnly(project(":pl.tlinkowski.unij.bundle.jdk11")) 30 | 31 | jmhRuntimeOnly(project(":pl.tlinkowski.unij.bundle.jdk11")) 32 | } 33 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/jmh/java/pl/tlinkowski/unij/api/UniListsBenchmark.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import java.util.List; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | import org.openjdk.jmh.annotations.*; 24 | 25 | /** 26 | * @author Tomasz Linkowski 27 | */ 28 | @BenchmarkMode(Mode.AverageTime) 29 | @OutputTimeUnit(TimeUnit.NANOSECONDS) 30 | public class UniListsBenchmark { 31 | 32 | //region of() 33 | @Benchmark 34 | public List listOf() { 35 | return List.of(); 36 | } 37 | 38 | @Benchmark 39 | public List uniListsOf() { 40 | return UniLists.of(); 41 | } 42 | //endregion 43 | 44 | //region of(n=1) 45 | @Benchmark 46 | public List listOf1() { 47 | return List.of(1); 48 | } 49 | 50 | @Benchmark 51 | public List uniListsOf1() { 52 | return UniLists.of(1); 53 | } 54 | //endregion 55 | 56 | //region of(n=2) 57 | @Benchmark 58 | public List listOf2() { 59 | return List.of(1, 2); 60 | } 61 | 62 | @Benchmark 63 | public List uniListsOf2() { 64 | return UniLists.of(1, 2); 65 | } 66 | //endregion 67 | 68 | //region of(n=3) 69 | @Benchmark 70 | public List listOf3() { 71 | return List.of(1, 2, 3); 72 | } 73 | 74 | @Benchmark 75 | public List uniListsOf3() { 76 | return UniLists.of(1, 2, 3); 77 | } 78 | //endregion 79 | 80 | //region of(n=10) 81 | @Benchmark 82 | public List listOf10() { 83 | return List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 84 | } 85 | 86 | @Benchmark 87 | public List uniListsOf10() { 88 | return UniLists.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 89 | } 90 | //endregion 91 | 92 | //region of(n=20) 93 | @Benchmark 94 | public List listOf20() { 95 | return List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 96 | } 97 | 98 | @Benchmark 99 | public List uniListsOf20() { 100 | return UniLists.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 101 | } 102 | //endregion 103 | } 104 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.api.*; 19 | import pl.tlinkowski.unij.service.api.collect.*; 20 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 21 | 22 | /** 23 | * UniJ API for the end users. 24 | *

25 | * The API consists of the following static utility classes: {@link UniLists}, {@link UniSets}, {@link UniMaps}, {@link 26 | * UniCollectors}. 27 | * 28 | * @author Tomasz Linkowski 29 | * @uses UnmodifiableListFactory 30 | * @uses UnmodifiableSetFactory 31 | * @uses UnmodifiableMapFactory 32 | * @uses MiscellaneousApiProvider 33 | */ 34 | module pl.tlinkowski.unij.api { 35 | exports pl.tlinkowski.unij.api; 36 | 37 | requires pl.tlinkowski.unij.service.api; 38 | requires org.slf4j; 39 | 40 | requires static pl.tlinkowski.annotation.basic; 41 | requires static lombok; 42 | 43 | uses UnmodifiableListFactory; 44 | uses UnmodifiableSetFactory; 45 | uses UnmodifiableMapFactory; 46 | uses MiscellaneousApiProvider; 47 | } 48 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniCollectors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import java.util.*; 21 | import java.util.function.*; 22 | import java.util.stream.*; 23 | 24 | import lombok.experimental.UtilityClass; 25 | 26 | /** 27 | * Provides some {@link Collector} factory methods present in {@link java.util.stream.Collectors} class. 28 | * 29 | * @author Tomasz Linkowski 30 | */ 31 | @UtilityClass 32 | public final class UniCollectors { 33 | 34 | //region COLLECTIONS 35 | 36 | /** 37 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableList()}. 38 | */ 39 | public static Collector> toUnmodifiableList() { 40 | return UniJ.listFactory().collector(); 41 | } 42 | 43 | /** 44 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableSet()}. 45 | */ 46 | public static Collector> toUnmodifiableSet() { 47 | return UniJ.setFactory().collector(); 48 | } 49 | 50 | /** 51 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableMap(Function, Function)}. 52 | */ 53 | public static Collector> toUnmodifiableMap( 54 | Function keyMapper, Function valueMapper) { 55 | return UniJ.mapFactory().collector(keyMapper, valueMapper); 56 | } 57 | 58 | /** 59 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableMap(Function, Function, BinaryOperator)}. 60 | */ 61 | public static Collector> toUnmodifiableMap( 62 | Function keyMapper, Function valueMapper, 63 | BinaryOperator mergeFunction) { 64 | return UniJ.mapFactory().collector(keyMapper, valueMapper, mergeFunction); 65 | } 66 | //endregion 67 | 68 | //region MISCELLANEOUS 69 | 70 | /** 71 | * Equivalent of {@link Collectors#flatMapping(Function, Collector)}. 72 | */ 73 | public static Collector flatMapping( 74 | Function> mapper, Collector downstream) { 75 | return UniJ.miscProvider().flatMappingCollector(mapper, downstream); 76 | } 77 | 78 | /** 79 | * Equivalent of {@link Collectors#filtering(Predicate, Collector)}. 80 | */ 81 | public static Collector filtering(Predicate predicate, 82 | Collector downstream) { 83 | return UniJ.miscProvider().filteringCollector(predicate, downstream); 84 | } 85 | //endregion 86 | } 87 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniJ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import lombok.Getter; 21 | import lombok.experimental.UtilityClass; 22 | 23 | import pl.tlinkowski.unij.service.api.collect.*; 24 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 25 | 26 | /** 27 | * @author Tomasz Linkowski 28 | */ 29 | @UtilityClass 30 | final class UniJ { 31 | 32 | @Getter(lazy = true) 33 | private static final UnmodifiableListFactory listFactory = UniJLoader.load(UnmodifiableListFactory.class); 34 | @Getter(lazy = true) 35 | private static final UnmodifiableSetFactory setFactory = UniJLoader.load(UnmodifiableSetFactory.class); 36 | @Getter(lazy = true) 37 | private static final UnmodifiableMapFactory mapFactory = UniJLoader.load(UnmodifiableMapFactory.class); 38 | 39 | @Getter(lazy = true) 40 | private static final MiscellaneousApiProvider miscProvider = UniJLoader.load(MiscellaneousApiProvider.class); 41 | } 42 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniJException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | /** 21 | * Dedicated unchecked exception for UniJ. 22 | * 23 | * @author Tomasz Linkowski 24 | */ 25 | public class UniJException extends RuntimeException { 26 | 27 | public UniJException(String message) { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniJLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import java.util.*; 21 | import java.util.function.Function; 22 | import java.util.stream.Collectors; 23 | 24 | import kotlin.annotations.jvm.Mutable; 25 | import kotlin.annotations.jvm.ReadOnly; 26 | import lombok.experimental.UtilityClass; 27 | import lombok.extern.slf4j.Slf4j; 28 | 29 | import pl.tlinkowski.unij.service.api.UniJService; 30 | 31 | /** 32 | * Loads UniJ services (used internally by {@link UniJ}). 33 | * 34 | * @author Tomasz Linkowski 35 | */ 36 | @UtilityClass 37 | @Slf4j 38 | final class UniJLoader { 39 | 40 | static S load(Class serviceClass) { 41 | @Mutable List services = new ArrayList<>(4); 42 | ServiceLoader.load(serviceClass).forEach(services::add); 43 | validateLoadedServices(services, serviceClass); 44 | return selectService(services, serviceClass); 45 | } 46 | 47 | private static void validateLoadedServices(@ReadOnly Collection services, Class serviceClass) { 48 | if (services.isEmpty()) { 49 | throw new UniJException(String.format( 50 | "%s service implementation not found. " 51 | + "Ensure proper pl.tlinkowski.unij.service.* dependency is on the runtime classpath/modulepath", 52 | serviceClass.getName() 53 | )); 54 | } 55 | log.debug("{} service: found {}", serviceClass.getName(), services); 56 | } 57 | 58 | private static S selectService(@ReadOnly Collection services, Class serviceClass) { 59 | return selectService(buildPriorityServiceMap(services), serviceClass); 60 | } 61 | 62 | private static S selectService(@ReadOnly SortedMap priorityServiceMap, Class serviceClass) { 63 | Integer highestPriority = priorityServiceMap.firstKey(); 64 | S highestPriorityService = priorityServiceMap.get(highestPriority); 65 | 66 | log.info( 67 | "{} service: selected {} (priority={})", 68 | serviceClass.getName(), className(highestPriorityService), highestPriority 69 | ); 70 | return highestPriorityService; 71 | } 72 | 73 | @ReadOnly 74 | private static SortedMap buildPriorityServiceMap(@ReadOnly Collection services) { 75 | return services.stream().collect(Collectors.toMap( 76 | UniJLoader::detectPriority, Function.identity(), UniJLoader::throwOnDuplicatePriority, TreeMap::new 77 | )); 78 | } 79 | 80 | private static int detectPriority(Object service) { 81 | UniJService uniJServiceAnn = service.getClass().getAnnotation(UniJService.class); 82 | if (uniJServiceAnn == null) { 83 | throw new UniJException(String.format( 84 | "Service implementation %s not annotated with @%s", className(service), UniJService.class.getSimpleName() 85 | )); 86 | } 87 | return uniJServiceAnn.priority(); 88 | } 89 | 90 | private static S throwOnDuplicatePriority(S service1, S service2) { 91 | throw new UniJException(String.format( 92 | "%s and %s have the same priority", className(service1), className(service2) 93 | )); 94 | } 95 | 96 | private static String className(Object object) { 97 | return object.getClass().getName(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniLists.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import java.util.Collection; 21 | import java.util.List; 22 | 23 | import kotlin.annotations.jvm.ReadOnly; 24 | import lombok.experimental.UtilityClass; 25 | 26 | /** 27 | * Provides static factory methods corresponding to those present in {@link List} interface. 28 | * 29 | * @author Tomasz Linkowski 30 | */ 31 | @UtilityClass 32 | public final class UniLists { 33 | 34 | //region COPY OF 35 | 36 | /** 37 | * Equivalent of {@link List#copyOf(Collection)}. 38 | */ 39 | @ReadOnly 40 | public static List copyOf(@ReadOnly Collection coll) { 41 | return UniJ.listFactory().copyOf(coll); 42 | } 43 | //endregion 44 | 45 | //region OF 46 | 47 | /** 48 | * Equivalent of {@link List#of()}. 49 | */ 50 | @ReadOnly 51 | public static List of() { 52 | return UniJ.listFactory().of(); 53 | } 54 | 55 | /** 56 | * Equivalent of {@link List#of(Object)}. 57 | */ 58 | @ReadOnly 59 | public static List of(E e1) { 60 | return UniJ.listFactory().of(e1); 61 | } 62 | 63 | /** 64 | * Equivalent of {@link List#of(Object, Object)}. 65 | */ 66 | @ReadOnly 67 | public static List of(E e1, E e2) { 68 | return UniJ.listFactory().of(e1, e2); 69 | } 70 | 71 | /** 72 | * Equivalent of {@link List#of(Object, Object, Object)}. 73 | */ 74 | @ReadOnly 75 | public static List of(E e1, E e2, E e3) { 76 | return UniJ.listFactory().of(e1, e2, e3); 77 | } 78 | 79 | /** 80 | * Equivalent of {@link List#of(Object, Object, Object, Object)}. 81 | */ 82 | @ReadOnly 83 | public static List of(E e1, E e2, E e3, E e4) { 84 | return UniJ.listFactory().of(e1, e2, e3, e4); 85 | } 86 | 87 | /** 88 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object)}. 89 | */ 90 | @ReadOnly 91 | public static List of(E e1, E e2, E e3, E e4, E e5) { 92 | return UniJ.listFactory().of(e1, e2, e3, e4, e5); 93 | } 94 | 95 | /** 96 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object)}. 97 | */ 98 | @ReadOnly 99 | public static List of(E e1, E e2, E e3, E e4, E e5, E e6) { 100 | return UniJ.listFactory().of(e1, e2, e3, e4, e5, e6); 101 | } 102 | 103 | /** 104 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object)}. 105 | */ 106 | @ReadOnly 107 | public static List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 108 | return UniJ.listFactory().of(e1, e2, e3, e4, e5, e6, e7); 109 | } 110 | 111 | /** 112 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object)}. 113 | */ 114 | @ReadOnly 115 | public static List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 116 | return UniJ.listFactory().of(e1, e2, e3, e4, e5, e6, e7, e8); 117 | } 118 | 119 | /** 120 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 121 | */ 122 | @ReadOnly 123 | public static List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 124 | return UniJ.listFactory().of(e1, e2, e3, e4, e5, e6, e7, e8, e9); 125 | } 126 | 127 | /** 128 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 129 | */ 130 | @SuppressWarnings("PMD.ExcessiveParameterList") 131 | @ReadOnly 132 | public static List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 133 | return UniJ.listFactory().of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); 134 | } 135 | 136 | /** 137 | * Equivalent of {@link List#of(Object[])}. 138 | */ 139 | @SafeVarargs 140 | @ReadOnly 141 | public static List of(E... elements) { 142 | return UniJ.listFactory().of(elements); 143 | } 144 | //endregion 145 | } 146 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/UniSets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api; 19 | 20 | import java.util.*; 21 | 22 | import kotlin.annotations.jvm.ReadOnly; 23 | import lombok.experimental.UtilityClass; 24 | 25 | /** 26 | * Provides static factory methods corresponding to those present in {@link Set} interface. 27 | * 28 | * @author Tomasz Linkowski 29 | */ 30 | @UtilityClass 31 | public final class UniSets { 32 | 33 | //region COPY OF 34 | 35 | /** 36 | * Equivalent of {@link Set#copyOf(Collection)}. 37 | */ 38 | @ReadOnly 39 | public static Set copyOf(@ReadOnly Collection coll) { 40 | return UniJ.setFactory().copyOf(coll); 41 | } 42 | //endregion 43 | 44 | //region OF 45 | 46 | /** 47 | * Equivalent of {@link Set#of()}. 48 | */ 49 | @ReadOnly 50 | public static Set of() { 51 | return UniJ.setFactory().of(); 52 | } 53 | 54 | /** 55 | * Equivalent of {@link Set#of(Object)}. 56 | */ 57 | @ReadOnly 58 | public static Set of(E e1) { 59 | return UniJ.setFactory().of(e1); 60 | } 61 | 62 | /** 63 | * Equivalent of {@link Set#of(Object, Object)}. 64 | */ 65 | @ReadOnly 66 | public static Set of(E e1, E e2) { 67 | return UniJ.setFactory().of(e1, e2); 68 | } 69 | 70 | /** 71 | * Equivalent of {@link Set#of(Object, Object, Object)}. 72 | */ 73 | @ReadOnly 74 | public static Set of(E e1, E e2, E e3) { 75 | return UniJ.setFactory().of(e1, e2, e3); 76 | } 77 | 78 | /** 79 | * Equivalent of {@link Set#of(Object, Object, Object, Object)}. 80 | */ 81 | @ReadOnly 82 | public static Set of(E e1, E e2, E e3, E e4) { 83 | return UniJ.setFactory().of(e1, e2, e3, e4); 84 | } 85 | 86 | /** 87 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object)}. 88 | */ 89 | @ReadOnly 90 | public static Set of(E e1, E e2, E e3, E e4, E e5) { 91 | return UniJ.setFactory().of(e1, e2, e3, e4, e5); 92 | } 93 | 94 | /** 95 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object)}. 96 | */ 97 | @ReadOnly 98 | public static Set of(E e1, E e2, E e3, E e4, E e5, E e6) { 99 | return UniJ.setFactory().of(e1, e2, e3, e4, e5, e6); 100 | } 101 | 102 | /** 103 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object)}. 104 | */ 105 | @ReadOnly 106 | public static Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 107 | return UniJ.setFactory().of(e1, e2, e3, e4, e5, e6, e7); 108 | } 109 | 110 | /** 111 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object)}. 112 | */ 113 | @ReadOnly 114 | public static Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 115 | return UniJ.setFactory().of(e1, e2, e3, e4, e5, e6, e7, e8); 116 | } 117 | 118 | /** 119 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 120 | */ 121 | @ReadOnly 122 | public static Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 123 | return UniJ.setFactory().of(e1, e2, e3, e4, e5, e6, e7, e8, e9); 124 | } 125 | 126 | /** 127 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 128 | */ 129 | @SuppressWarnings("PMD.ExcessiveParameterList") 130 | @ReadOnly 131 | public static Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 132 | return UniJ.setFactory().of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); 133 | } 134 | 135 | /** 136 | * Equivalent of {@link Set#of(Object[])}. 137 | */ 138 | @SafeVarargs 139 | @ReadOnly 140 | public static Set of(E... elements) { 141 | return UniJ.setFactory().of(elements); 142 | } 143 | //endregion 144 | } 145 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/main/java/pl/tlinkowski/unij/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ API for the end users. 20 | * 21 | * @author Tomasz Linkowski 22 | */ 23 | @NonNullPackage 24 | package pl.tlinkowski.unij.api; 25 | 26 | import pl.tlinkowski.annotation.basic.NonNullPackage; 27 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/groovy/pl/tlinkowski/unij/api/UniCollectorsSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api 19 | 20 | import spock.lang.Specification 21 | 22 | import java.util.stream.Collectors 23 | import java.util.stream.Stream 24 | 25 | /** 26 | * @author Tomasz Linkowski 27 | */ 28 | class UniCollectorsSpec extends Specification { 29 | 30 | def "toUnmodifiableList()"(List list) { 31 | expect: 32 | list.stream().collect(UniCollectors.toUnmodifiableList()) == list 33 | where: 34 | list | _ 35 | [] | _ 36 | [1] | _ 37 | [1, 2] | _ 38 | [1, 2, 3] | _ 39 | } 40 | 41 | def "toUnmodifiableSet()"(Set set) { 42 | expect: 43 | set.stream().collect(UniCollectors.toUnmodifiableSet()) == set 44 | where: 45 | set | _ 46 | [] | _ 47 | [1] | _ 48 | [1, 2] | _ 49 | [1, 2, 3] | _ 50 | } 51 | 52 | //region TO UNMODIFIABLE MAP (excerpt from AbstractUnmodifiableMapFactorySpec) 53 | def "toUnmodifiableMap(keyMapper,valueMapper)"(Map map) { 54 | given: 55 | def entryStream = map.entrySet().stream() 56 | def collector = UniCollectors.toUnmodifiableMap({ it.getKey() }, { it.getValue() }) 57 | expect: 58 | entryStream.collect(collector) == map 59 | where: 60 | map | _ 61 | [:] | _ 62 | ["a": 1] | _ 63 | ["a": 1, "b": 2] | _ 64 | ["a": 1, "b": 2, "c": 3] | _ 65 | } 66 | 67 | def "toUnmodifiableMap(keyMapper,valueMapper,mergeFunction)"(List> maps, 68 | Map merged) { 69 | given: 70 | def entryStream = maps.stream().flatMap { it.entrySet().stream() } 71 | def collector = UniCollectors.toUnmodifiableMap( 72 | { it.getKey() }, { it.getValue() }, { l, r -> l + r } 73 | ) 74 | expect: 75 | entryStream.collect(collector) == merged 76 | where: 77 | maps | merged 78 | [] | [:] 79 | [["a": 1]] | ["a": 1] 80 | [["a": 1], ["b": 2]] | ["a": 1, "b": 2] 81 | [["a": 1, "b": 2], ["b": 3]] | ["a": 1, "b": 5] 82 | } 83 | //endregion 84 | 85 | //region MISCELLANEOUS (corresponds to COLLECTORS: STANDARD CONTRACT region of AbstractMiscellaneousApiProviderSpec) 86 | def "flatMapping(mapper,downstream)"(List list, List expected) { 87 | when: 88 | def collector = UniCollectors.flatMapping({ Stream.of(it, -it) }, Collectors.toList()) 89 | then: 90 | list.stream().collect(collector) == expected 91 | where: 92 | list | expected 93 | [] | [] 94 | [1] | [1, -1] 95 | [-1] | [-1, 1] 96 | [1, 2] | [1, -1, 2, -2] 97 | [1, 2, 3] | [1, -1, 2, -2, 3, -3] 98 | } 99 | 100 | def "filtering(predicate,downstream)"(List list, List expected) { 101 | when: 102 | def collector = UniCollectors.filtering({ it % 2 != 0 }, Collectors.toList()) 103 | then: 104 | list.stream().collect(collector) == expected 105 | where: 106 | list | expected 107 | [] | [] 108 | [1] | [1] 109 | [2] | [] 110 | [1, 2] | [1] 111 | [1, 2, 3] | [1, 3] 112 | } 113 | //endregion 114 | } 115 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/groovy/pl/tlinkowski/unij/api/UniJLoaderSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.service.api.UniJService 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class UniJLoaderSpec extends Specification { 28 | 29 | //region SERVICE WITHOUT IMPLEMENTATION 30 | def "load() throws when service implementation is missing"() { 31 | when: 32 | UniJLoader.load(NoImplService) 33 | then: 34 | UniJException ex = thrown() 35 | ex.message.contains(NoImplService.name) 36 | ex.message.contains("service implementation not found") 37 | } 38 | 39 | interface NoImplService { 40 | } 41 | //endregion 42 | 43 | //region MISSING @UniJService ANNOTATION 44 | def "load() throws when @UniJService annotation is missing"() { 45 | when: 46 | UniJLoader.load(UnannotatedService) 47 | then: 48 | UniJException ex = thrown() 49 | ex.message.contains(UnannotatedServiceImpl.name) 50 | ex.message.contains("not annotated with") 51 | } 52 | 53 | interface UnannotatedService { 54 | } 55 | 56 | static class UnannotatedServiceImpl implements UnannotatedService { 57 | } 58 | //endregion 59 | 60 | //region DUPLICATE PRIORITY 61 | def "load() throws when two service implementations have the same priority"() { 62 | when: 63 | UniJLoader.load(DuplicatePriorityService) 64 | then: 65 | UniJException ex = thrown() 66 | ex.message.contains(DuplicatePriorityServiceImpl1.name) 67 | ex.message.contains(DuplicatePriorityServiceImpl2.name) 68 | ex.message.contains("same priority") 69 | } 70 | 71 | interface DuplicatePriorityService { 72 | } 73 | 74 | @UniJService(priority = 10) 75 | static class DuplicatePriorityServiceImpl1 implements DuplicatePriorityService { 76 | } 77 | 78 | @UniJService(priority = 10) 79 | static class DuplicatePriorityServiceImpl2 implements DuplicatePriorityService { 80 | } 81 | //endregion 82 | 83 | //region DIFFERENT PRIORITY 84 | def "load() selects implementation with a higher priority"() { 85 | when: 86 | def service = UniJLoader.load(DifferentPriorityService) 87 | then: 88 | service instanceof DifferentPriorityServiceImpl2 89 | } 90 | 91 | interface DifferentPriorityService { 92 | } 93 | 94 | @UniJService(priority = 10) 95 | static class DifferentPriorityServiceImpl1 implements DifferentPriorityService { 96 | } 97 | 98 | @UniJService(priority = -10) 99 | static class DifferentPriorityServiceImpl2 implements DifferentPriorityService { 100 | } 101 | //endregion 102 | } 103 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/groovy/pl/tlinkowski/unij/api/UniListsSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api 19 | 20 | import spock.lang.Specification 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class UniListsSpec extends Specification { 26 | 27 | def "copyOf"(List list) { 28 | expect: 29 | UniLists.copyOf(list) == List.copyOf(list) 30 | where: 31 | list | _ 32 | [] | _ 33 | [1] | _ 34 | [1, 2] | _ 35 | [1, 2, 3] | _ 36 | } 37 | 38 | def "of(n=0)"() { 39 | expect: 40 | UniLists.of() == List.of() 41 | } 42 | 43 | def "of(n=1)"() { 44 | expect: 45 | UniLists.of(1) == List.of(1) 46 | } 47 | 48 | def "of(n=2)"() { 49 | expect: 50 | UniLists.of(1, 2) == List.of(1, 2) 51 | } 52 | 53 | def "of(n=3)"() { 54 | expect: 55 | UniLists.of(1, 2, 3) == List.of(1, 2, 3) 56 | } 57 | 58 | def "of(n=4)"() { 59 | expect: 60 | UniLists.of(1, 2, 3, 4) == List.of(1, 2, 3, 4) 61 | } 62 | 63 | def "of(n=5)"() { 64 | expect: 65 | UniLists.of(1, 2, 3, 4, 5) == List.of(1, 2, 3, 4, 5) 66 | } 67 | 68 | def "of(n=6)"() { 69 | expect: 70 | UniLists.of(1, 2, 3, 4, 5, 6) == 71 | List.of(1, 2, 3, 4, 5, 6) 72 | } 73 | 74 | def "of(n=7)"() { 75 | expect: 76 | UniLists.of(1, 2, 3, 4, 5, 6, 7) == 77 | List.of(1, 2, 3, 4, 5, 6, 7) 78 | } 79 | 80 | def "of(n=8)"() { 81 | expect: 82 | UniLists.of(1, 2, 3, 4, 5, 6, 7, 8) == 83 | List.of(1, 2, 3, 4, 5, 6, 7, 8) 84 | } 85 | 86 | def "of(n=9)"() { 87 | expect: 88 | UniLists.of(1, 2, 3, 4, 5, 6, 7, 8, 9) == 89 | List.of(1, 2, 3, 4, 5, 6, 7, 8, 9) 90 | } 91 | 92 | def "of(n=10)"() { 93 | expect: 94 | UniLists.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 95 | List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 96 | } 97 | 98 | def "of(...)"() { 99 | expect: 100 | UniLists.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) == 101 | List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/groovy/pl/tlinkowski/unij/api/UniMapsSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api 19 | 20 | import spock.lang.Specification 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class UniMapsSpec extends Specification { 26 | 27 | def "copyOf"(Map map) { 28 | expect: 29 | UniMaps.copyOf(map) == Map.copyOf(map) 30 | where: 31 | map | _ 32 | [:] | _ 33 | ["a": 1] | _ 34 | ["a": 1, "b": 2] | _ 35 | ["a": 1, "b": 2, "c": 3] | _ 36 | } 37 | 38 | // region ENTRIES (corresponds to ENTRIES region of AbstractUnmodifiableMapFactorySpec) 39 | def "ofEntries(...)"() { 40 | given: 41 | def expected = Map.ofEntries( 42 | Map.entry("a", 1), 43 | Map.entry("b", 2), 44 | Map.entry("c", 3) 45 | ) 46 | when: 47 | def actual = UniMaps.ofEntries( 48 | UniMaps.entry("a", 1), 49 | UniMaps.entry("b", 2), 50 | UniMaps.entry("c", 3) 51 | ) 52 | then: 53 | actual == expected 54 | } 55 | 56 | def "entry"() { 57 | expect: 58 | UniMaps.entry("a", 1) == Map.entry("a", 1) 59 | } 60 | //endregion 61 | 62 | def "of(n=0)"() { 63 | expect: 64 | UniMaps.of() == Map.of() 65 | } 66 | 67 | def "of(n=1)"() { 68 | expect: 69 | UniMaps.of("a", 1) == Map.of("a", 1) 70 | } 71 | 72 | def "of(n=2)"() { 73 | expect: 74 | UniMaps.of("a", 1, "b", 2) == Map.of("a", 1, "b", 2) 75 | } 76 | 77 | def "of(n=3)"() { 78 | expect: 79 | UniMaps.of("a", 1, "b", 2, "c", 3) == 80 | Map.of("a", 1, "b", 2, "c", 3) 81 | } 82 | 83 | def "of(n=4)"() { 84 | expect: 85 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4) == 86 | Map.of("a", 1, "b", 2, "c", 3, "d", 4) 87 | } 88 | 89 | def "of(n=5)"() { 90 | expect: 91 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5) == 92 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5) 93 | } 94 | 95 | def "of(n=6)"() { 96 | expect: 97 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6) == 98 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6) 99 | } 100 | 101 | def "of(n=7)"() { 102 | expect: 103 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7) == 104 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7) 105 | } 106 | 107 | def "of(n=8)"() { 108 | expect: 109 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8) == 110 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8) 111 | } 112 | 113 | def "of(n=9)"() { 114 | expect: 115 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i", 9) == 116 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i", 9) 117 | } 118 | 119 | def "of(n=10)"() { 120 | expect: 121 | UniMaps.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i", 9, "j", 10) == 122 | Map.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i", 9, "j", 10) 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/groovy/pl/tlinkowski/unij/api/UniSetsSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.api 19 | 20 | import spock.lang.Specification 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class UniSetsSpec extends Specification { 26 | 27 | def "copyOf"(Set list) { 28 | expect: 29 | UniSets.copyOf(list) == Set.copyOf(list) 30 | where: 31 | list | _ 32 | [] | _ 33 | [1] | _ 34 | [1, 2] | _ 35 | [1, 2, 3] | _ 36 | } 37 | 38 | def "of(n=0)"() { 39 | expect: 40 | UniSets.of() == Set.of() 41 | } 42 | 43 | def "of(n=1)"() { 44 | expect: 45 | UniSets.of(1) == Set.of(1) 46 | } 47 | 48 | def "of(n=2)"() { 49 | expect: 50 | UniSets.of(1, 2) == Set.of(1, 2) 51 | } 52 | 53 | def "of(n=3)"() { 54 | expect: 55 | UniSets.of(1, 2, 3) == Set.of(1, 2, 3) 56 | } 57 | 58 | def "of(n=4)"() { 59 | expect: 60 | UniSets.of(1, 2, 3, 4) == Set.of(1, 2, 3, 4) 61 | } 62 | 63 | def "of(n=5)"() { 64 | expect: 65 | UniSets.of(1, 2, 3, 4, 5) == Set.of(1, 2, 3, 4, 5) 66 | } 67 | 68 | def "of(n=6)"() { 69 | expect: 70 | UniSets.of(1, 2, 3, 4, 5, 6) == 71 | Set.of(1, 2, 3, 4, 5, 6) 72 | } 73 | 74 | def "of(n=7)"() { 75 | expect: 76 | UniSets.of(1, 2, 3, 4, 5, 6, 7) == 77 | Set.of(1, 2, 3, 4, 5, 6, 7) 78 | } 79 | 80 | def "of(n=8)"() { 81 | expect: 82 | UniSets.of(1, 2, 3, 4, 5, 6, 7, 8) == 83 | Set.of(1, 2, 3, 4, 5, 6, 7, 8) 84 | } 85 | 86 | def "of(n=9)"() { 87 | expect: 88 | UniSets.of(1, 2, 3, 4, 5, 6, 7, 8, 9) == 89 | Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9) 90 | } 91 | 92 | def "of(n=10)"() { 93 | expect: 94 | UniSets.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 95 | Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 96 | } 97 | 98 | def "of(...)"() { 99 | expect: 100 | UniSets.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) == 101 | Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/resources/META-INF/services/pl.tlinkowski.unij.api.UniJLoaderSpec$DifferentPriorityService: -------------------------------------------------------------------------------- 1 | pl.tlinkowski.unij.api.UniJLoaderSpec$DifferentPriorityServiceImpl1 2 | pl.tlinkowski.unij.api.UniJLoaderSpec$DifferentPriorityServiceImpl2 3 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/resources/META-INF/services/pl.tlinkowski.unij.api.UniJLoaderSpec$DuplicatePriorityService: -------------------------------------------------------------------------------- 1 | pl.tlinkowski.unij.api.UniJLoaderSpec$DuplicatePriorityServiceImpl1 2 | pl.tlinkowski.unij.api.UniJLoaderSpec$DuplicatePriorityServiceImpl2 3 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.api/src/test/resources/META-INF/services/pl.tlinkowski.unij.api.UniJLoaderSpec$UnannotatedService: -------------------------------------------------------------------------------- 1 | pl.tlinkowski.unij.api.UniJLoaderSpec$UnannotatedServiceImpl 2 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/pl.tlinkowski.unij.service.api.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.UniJService; 19 | 20 | /** 21 | * UniJ service interfaces. 22 | *

23 | * Note that all UniJ service implementations must be annotated with {@link UniJService} annotation. 24 | * 25 | * @author Tomasz Linkowski 26 | * @see java.util.ServiceLoader 27 | */ 28 | module pl.tlinkowski.unij.service.api { 29 | exports pl.tlinkowski.unij.service.api; 30 | exports pl.tlinkowski.unij.service.api.collect; 31 | exports pl.tlinkowski.unij.service.api.misc; 32 | 33 | requires static pl.tlinkowski.annotation.basic; 34 | } 35 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/UniJService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.api; 19 | 20 | import java.lang.annotation.*; 21 | 22 | /** 23 | * Annotation that should be present on all implementations of UniJ services. 24 | *

25 | * Should always be accompanied by Google's {@code @AutoService} annotation. 26 | * 27 | * @author Tomasz Linkowski 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.TYPE) 31 | public @interface UniJService { 32 | 33 | /** 34 | * Loading priority of this service. Smaller numbers mean higher priority (priority may be negative). 35 | */ 36 | int priority(); 37 | } 38 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/collect/UnmodifiableListFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.api.collect; 19 | 20 | import java.util.Collection; 21 | import java.util.List; 22 | import java.util.stream.Collector; 23 | 24 | import kotlin.annotations.jvm.ReadOnly; 25 | 26 | /** 27 | * Proxy for 28 | * unmodifiable 29 | * factory methods available in the {@link List} interface. 30 | * 31 | * @author Tomasz Linkowski 32 | */ 33 | public interface UnmodifiableListFactory { 34 | 35 | //region COLLECTOR 36 | 37 | /** 38 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableList()}. 39 | */ 40 | Collector> collector(); 41 | //endregion 42 | 43 | //region COPY OF 44 | 45 | /** 46 | * Equivalent of {@link List#copyOf(Collection)}. 47 | */ 48 | @ReadOnly 49 | List copyOf(@ReadOnly Collection coll); 50 | //endregion 51 | 52 | //region OF 53 | 54 | /** 55 | * Equivalent of {@link List#of()}. 56 | */ 57 | @ReadOnly 58 | List of(); 59 | 60 | /** 61 | * Equivalent of {@link List#of(Object)}. 62 | */ 63 | @ReadOnly 64 | List of(E e1); 65 | 66 | /** 67 | * Equivalent of {@link List#of(Object, Object)}. 68 | */ 69 | @ReadOnly 70 | List of(E e1, E e2); 71 | 72 | /** 73 | * Equivalent of {@link List#of(Object, Object, Object)}. 74 | */ 75 | @ReadOnly 76 | List of(E e1, E e2, E e3); 77 | 78 | /** 79 | * Equivalent of {@link List#of(Object, Object, Object, Object)}. 80 | */ 81 | @ReadOnly 82 | List of(E e1, E e2, E e3, E e4); 83 | 84 | /** 85 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object)}. 86 | */ 87 | @ReadOnly 88 | List of(E e1, E e2, E e3, E e4, E e5); 89 | 90 | /** 91 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object)}. 92 | */ 93 | @ReadOnly 94 | List of(E e1, E e2, E e3, E e4, E e5, E e6); 95 | 96 | /** 97 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object)}. 98 | */ 99 | @ReadOnly 100 | List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7); 101 | 102 | /** 103 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object)}. 104 | */ 105 | @ReadOnly 106 | List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8); 107 | 108 | /** 109 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 110 | */ 111 | @ReadOnly 112 | List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9); 113 | 114 | /** 115 | * Equivalent of {@link List#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 116 | */ 117 | @SuppressWarnings("PMD.ExcessiveParameterList") 118 | @ReadOnly 119 | List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10); 120 | 121 | /** 122 | * Equivalent of {@link List#of(Object[])}. 123 | */ 124 | @SuppressWarnings("unchecked") 125 | @ReadOnly 126 | List of(E... elements); 127 | //endregion 128 | } 129 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/collect/UnmodifiableSetFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.api.collect; 19 | 20 | import java.util.Collection; 21 | import java.util.Set; 22 | import java.util.stream.Collector; 23 | 24 | import kotlin.annotations.jvm.ReadOnly; 25 | 26 | /** 27 | * Proxy for 28 | * unmodifiable 29 | * factory methods available in the {@link Set} interface. 30 | * 31 | * @author Tomasz Linkowski 32 | */ 33 | public interface UnmodifiableSetFactory { 34 | 35 | //region COLLECTOR 36 | 37 | /** 38 | * Equivalent of {@link java.util.stream.Collectors#toUnmodifiableSet()}. 39 | */ 40 | Collector> collector(); 41 | //endregion 42 | 43 | //region COPY OF 44 | 45 | /** 46 | * Equivalent of {@link Set#copyOf(Collection)}. 47 | */ 48 | @ReadOnly 49 | Set copyOf(@ReadOnly Collection coll); 50 | //endregion 51 | 52 | //region OF 53 | 54 | /** 55 | * Equivalent of {@link Set#of()}. 56 | */ 57 | @ReadOnly 58 | Set of(); 59 | 60 | /** 61 | * Equivalent of {@link Set#of(Object)}. 62 | */ 63 | @ReadOnly 64 | Set of(E e1); 65 | 66 | /** 67 | * Equivalent of {@link Set#of(Object, Object)}. 68 | */ 69 | @ReadOnly 70 | Set of(E e1, E e2); 71 | 72 | /** 73 | * Equivalent of {@link Set#of(Object, Object, Object)}. 74 | */ 75 | @ReadOnly 76 | Set of(E e1, E e2, E e3); 77 | 78 | /** 79 | * Equivalent of {@link Set#of(Object, Object, Object, Object)}. 80 | */ 81 | @ReadOnly 82 | Set of(E e1, E e2, E e3, E e4); 83 | 84 | /** 85 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object)}. 86 | */ 87 | @ReadOnly 88 | Set of(E e1, E e2, E e3, E e4, E e5); 89 | 90 | /** 91 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object)}. 92 | */ 93 | @ReadOnly 94 | Set of(E e1, E e2, E e3, E e4, E e5, E e6); 95 | 96 | /** 97 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object)}. 98 | */ 99 | @ReadOnly 100 | Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7); 101 | 102 | /** 103 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object)}. 104 | */ 105 | @ReadOnly 106 | Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8); 107 | 108 | /** 109 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 110 | */ 111 | @ReadOnly 112 | Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9); 113 | 114 | /** 115 | * Equivalent of {@link Set#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)}. 116 | */ 117 | @SuppressWarnings("PMD.ExcessiveParameterList") 118 | @ReadOnly 119 | Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10); 120 | 121 | /** 122 | * Equivalent of {@link Set#of(Object[])}. 123 | */ 124 | @SuppressWarnings("unchecked") 125 | @ReadOnly 126 | Set of(E... elements); 127 | //endregion 128 | 129 | } 130 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/collect/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ {@link java.util.Collection}-factory service interfaces. 20 | * 21 | * @author Tomasz Linkowski 22 | * @see java.util.ServiceLoader 23 | */ 24 | @NonNullPackage 25 | package pl.tlinkowski.unij.service.api.collect; 26 | 27 | import pl.tlinkowski.annotation.basic.NonNullPackage; 28 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/misc/MiscellaneousApiProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.api.misc; 19 | 20 | import java.util.function.Function; 21 | import java.util.function.Predicate; 22 | import java.util.stream.*; 23 | 24 | /** 25 | * Provider of miscellaneous JDK APIs added since JDK 9. Provides: 26 | *

29 | * 30 | * @author Tomasz Linkowski 31 | */ 32 | public interface MiscellaneousApiProvider { 33 | 34 | //region COLLECTORS 35 | 36 | /** 37 | * Equivalent of {@link Collectors#flatMapping(Function, Collector)}. 38 | */ 39 | Collector flatMappingCollector(Function> mapper, 40 | Collector downstream); 41 | 42 | /** 43 | * Equivalent of {@link Collectors#filtering(Predicate, Collector)}. 44 | */ 45 | Collector filteringCollector(Predicate predicate, 46 | Collector downstream); 47 | //endregion 48 | } 49 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/misc/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * Miscellaneous UniJ service provider interfaces (e.g. {@link pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider}). 20 | * 21 | * @author Tomasz Linkowski 22 | * @see java.util.ServiceLoader 23 | */ 24 | @NonNullPackage 25 | package pl.tlinkowski.unij.service.api.misc; 26 | 27 | import pl.tlinkowski.annotation.basic.NonNullPackage; 28 | -------------------------------------------------------------------------------- /subprojects/api/pl.tlinkowski.unij.service.api/src/main/java/pl/tlinkowski/unij/service/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * API for UniJ services (e.g. {@link pl.tlinkowski.unij.service.api.UniJService} annotation). 20 | * 21 | * @author Tomasz Linkowski 22 | */ 23 | @NonNullPackage 24 | package pl.tlinkowski.unij.service.api; 25 | 26 | import pl.tlinkowski.annotation.basic.NonNullPackage; 27 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/pl.tlinkowski.unij.service.collect.eclipse.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | superpom.useLombok = true 21 | 22 | dependencies { 23 | val eclipseCollectionsLowVersion: String by project // https://www.eclipse.org/collections/ 24 | 25 | compileOnly(group = "org.eclipse.collections", name = "eclipse-collections", version = eclipseCollectionsLowVersion) 26 | testRuntimeOnly(group = "org.eclipse.collections", name = "eclipse-collections", version = eclipseCollectionsLowVersion) 27 | } 28 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.collect.*; 19 | import pl.tlinkowski.unij.service.collect.eclipse.*; 20 | 21 | /** 22 | * Unmodifiable-{@link java.util.Collection}-related Eclipse-based 23 | * bindings for UniJ. 24 | * 25 | * @author Tomasz Linkowski 26 | */ 27 | module pl.tlinkowski.unij.service.collect.eclipse { 28 | requires org.eclipse.collections.api; 29 | requires org.eclipse.collections.impl; 30 | 31 | requires pl.tlinkowski.unij.service.api; 32 | requires static pl.tlinkowski.annotation.basic; 33 | requires static auto.service.annotations; 34 | requires static lombok; 35 | 36 | provides UnmodifiableListFactory with EclipseUnmodifiableListFactory; 37 | provides UnmodifiableSetFactory with EclipseUnmodifiableSetFactory; 38 | provides UnmodifiableMapFactory with EclipseUnmodifiableMapFactory; 39 | } 40 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/src/main/java/pl/tlinkowski/unij/service/collect/eclipse/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ {@link java.util.Collection}-factory service implementations based on 20 | * Eclipse Collections. 21 | * 22 | * @author Tomasz Linkowski 23 | * @see java.util.ServiceLoader 24 | */ 25 | @NonNullPackage 26 | package pl.tlinkowski.unij.service.collect.eclipse; 27 | 28 | import pl.tlinkowski.annotation.basic.NonNullPackage; 29 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/src/test/groovy/pl/tlinkowski/unij/service/collect/eclipse/EclipseUnmodifiableListFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.eclipse 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableListFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EclipseUnmodifiableListFactorySpec extends UnmodifiableListFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new EclipseUnmodifiableListFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/src/test/groovy/pl/tlinkowski/unij/service/collect/eclipse/EclipseUnmodifiableMapFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.eclipse 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableMapFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EclipseUnmodifiableMapFactorySpec extends UnmodifiableMapFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new EclipseUnmodifiableMapFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.eclipse/src/test/groovy/pl/tlinkowski/unij/service/collect/eclipse/EclipseUnmodifiableSetFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.eclipse 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableSetFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EclipseUnmodifiableSetFactorySpec extends UnmodifiableSetFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new EclipseUnmodifiableSetFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/pl.tlinkowski.unij.service.collect.guava.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | superpom.useLombok = true 21 | 22 | dependencies { 23 | val guavaLowVersion: String by project // https://github.com/google/guava 24 | 25 | compileOnly(group = "com.google.guava", name = "guava", version = guavaLowVersion) 26 | testRuntimeOnly(group = "com.google.guava", name = "guava", version = guavaLowVersion) 27 | } 28 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.collect.*; 19 | import pl.tlinkowski.unij.service.collect.guava.*; 20 | 21 | /** 22 | * Unmodifiable-{@link java.util.Collection}-related Guava-based bindings 23 | * for UniJ. 24 | * 25 | * @author Tomasz Linkowski 26 | */ 27 | module pl.tlinkowski.unij.service.collect.guava { 28 | requires com.google.common; 29 | 30 | requires pl.tlinkowski.unij.service.api; 31 | requires static pl.tlinkowski.annotation.basic; 32 | requires static auto.service.annotations; 33 | requires static lombok; 34 | 35 | provides UnmodifiableListFactory with GuavaUnmodifiableListFactory; 36 | provides UnmodifiableSetFactory with GuavaUnmodifiableSetFactory; 37 | provides UnmodifiableMapFactory with GuavaUnmodifiableMapFactory; 38 | } 39 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/main/java/pl/tlinkowski/unij/service/collect/guava/GuavaUnmodifiableListFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.guava; 19 | 20 | import java.util.Collection; 21 | import java.util.List; 22 | import java.util.stream.Collector; 23 | 24 | import com.google.auto.service.AutoService; 25 | import com.google.common.collect.ImmutableList; 26 | 27 | import pl.tlinkowski.unij.service.api.UniJService; 28 | import pl.tlinkowski.unij.service.api.collect.UnmodifiableListFactory; 29 | 30 | /** 31 | * Implementation of {@link UnmodifiableListFactory} that returns Guava's {@link ImmutableList}s. 32 | * 33 | * @author Tomasz Linkowski 34 | */ 35 | @UniJService(priority = 20) 36 | @AutoService(UnmodifiableListFactory.class) 37 | public final class GuavaUnmodifiableListFactory implements UnmodifiableListFactory { 38 | 39 | //region COLLECTOR 40 | @SuppressWarnings("unchecked") 41 | @Override 42 | public Collector> collector() { 43 | return (Collector>) (Collector) ImmutableList.toImmutableList(); 44 | } 45 | //endregion 46 | 47 | //region COPY OF 48 | @Override 49 | public List copyOf(Collection coll) { 50 | return ImmutableList.copyOf(coll); 51 | } 52 | //endregion 53 | 54 | //region OF 55 | @Override 56 | public List of() { 57 | return ImmutableList.of(); 58 | } 59 | 60 | @Override 61 | public List of(E e1) { 62 | return ImmutableList.of(e1); 63 | } 64 | 65 | @Override 66 | public List of(E e1, E e2) { 67 | return ImmutableList.of(e1, e2); 68 | } 69 | 70 | @Override 71 | public List of(E e1, E e2, E e3) { 72 | return ImmutableList.of(e1, e2, e3); 73 | } 74 | 75 | @Override 76 | public List of(E e1, E e2, E e3, E e4) { 77 | return ImmutableList.of(e1, e2, e3, e4); 78 | } 79 | 80 | @Override 81 | public List of(E e1, E e2, E e3, E e4, E e5) { 82 | return ImmutableList.of(e1, e2, e3, e4, e5); 83 | } 84 | 85 | @Override 86 | public List of(E e1, E e2, E e3, E e4, E e5, E e6) { 87 | return ImmutableList.of(e1, e2, e3, e4, e5, e6); 88 | } 89 | 90 | @Override 91 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 92 | return ImmutableList.of(e1, e2, e3, e4, e5, e6, e7); 93 | } 94 | 95 | @Override 96 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 97 | return ImmutableList.of(e1, e2, e3, e4, e5, e6, e7, e8); 98 | } 99 | 100 | @Override 101 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 102 | return ImmutableList.of(e1, e2, e3, e4, e5, e6, e7, e8, e9); 103 | } 104 | 105 | @SuppressWarnings("PMD.ExcessiveParameterList") 106 | @Override 107 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 108 | return ImmutableList.of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); 109 | } 110 | 111 | @SafeVarargs 112 | @Override 113 | public final List of(E... elements) { 114 | return ImmutableList.copyOf(elements); 115 | } 116 | //endregion 117 | } 118 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/main/java/pl/tlinkowski/unij/service/collect/guava/GuavaUnmodifiableSetFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.guava; 19 | 20 | import java.util.Collection; 21 | import java.util.Set; 22 | import java.util.stream.Collector; 23 | 24 | import com.google.auto.service.AutoService; 25 | import com.google.common.collect.ImmutableSet; 26 | 27 | import pl.tlinkowski.unij.service.api.UniJService; 28 | import pl.tlinkowski.unij.service.api.collect.UnmodifiableSetFactory; 29 | 30 | /** 31 | * Implementation of {@link UnmodifiableSetFactory} that returns Guava's {@link ImmutableSet}. 32 | * 33 | * @author Tomasz Linkowski 34 | */ 35 | @UniJService(priority = 20) 36 | @AutoService(UnmodifiableSetFactory.class) 37 | public final class GuavaUnmodifiableSetFactory implements UnmodifiableSetFactory { 38 | 39 | //region COLLECTOR 40 | @SuppressWarnings("unchecked") 41 | @Override 42 | public Collector> collector() { 43 | return (Collector>) (Collector) ImmutableSet.toImmutableSet(); 44 | } 45 | //endregion 46 | 47 | //region COPY OF 48 | @Override 49 | public Set copyOf(Collection coll) { 50 | return ImmutableSet.copyOf(coll); 51 | } 52 | //endregion 53 | 54 | //region OF 55 | @Override 56 | public Set of() { 57 | return ImmutableSet.of(); 58 | } 59 | 60 | @Override 61 | public Set of(E e1) { 62 | return ImmutableSet.of(e1); 63 | } 64 | 65 | @Override 66 | public Set of(E e1, E e2) { 67 | return requireNoDuplicates(2, ImmutableSet.of(e1, e2)); 68 | } 69 | 70 | @Override 71 | public Set of(E e1, E e2, E e3) { 72 | return requireNoDuplicates(3, ImmutableSet.of(e1, e2, e3)); 73 | } 74 | 75 | @Override 76 | public Set of(E e1, E e2, E e3, E e4) { 77 | return requireNoDuplicates(4, ImmutableSet.of(e1, e2, e3, e4)); 78 | } 79 | 80 | @Override 81 | public Set of(E e1, E e2, E e3, E e4, E e5) { 82 | return requireNoDuplicates(5, ImmutableSet.of(e1, e2, e3, e4, e5)); 83 | } 84 | 85 | @Override 86 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6) { 87 | return requireNoDuplicates(6, ImmutableSet.of(e1, e2, e3, e4, e5, e6)); 88 | } 89 | 90 | @Override 91 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 92 | return requireNoDuplicates(7, ImmutableSet.of(e1, e2, e3, e4, e5, e6, e7)); 93 | } 94 | 95 | @Override 96 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 97 | return requireNoDuplicates(8, ImmutableSet.of(e1, e2, e3, e4, e5, e6, e7, e8)); 98 | } 99 | 100 | @Override 101 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 102 | return requireNoDuplicates(9, ImmutableSet.of(e1, e2, e3, e4, e5, e6, e7, e8, e9)); 103 | } 104 | 105 | @SuppressWarnings("PMD.ExcessiveParameterList") 106 | @Override 107 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 108 | return requireNoDuplicates(10, ImmutableSet.of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)); 109 | } 110 | 111 | @SafeVarargs 112 | @Override 113 | public final Set of(E... elements) { 114 | return requireNoDuplicates(elements.length, ImmutableSet.copyOf(elements)); 115 | } 116 | 117 | private static Set requireNoDuplicates(int size, ImmutableSet set) { 118 | if (set.size() < size) { 119 | throw new IllegalArgumentException("Duplicate element"); 120 | } 121 | return set; 122 | } 123 | //endregion 124 | } 125 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/main/java/pl/tlinkowski/unij/service/collect/guava/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ {@link java.util.Collection}-factory service implementations based on 20 | * Guava. 21 | * 22 | * @author Tomasz Linkowski 23 | * @see java.util.ServiceLoader 24 | */ 25 | @NonNullPackage 26 | package pl.tlinkowski.unij.service.collect.guava; 27 | 28 | import pl.tlinkowski.annotation.basic.NonNullPackage; 29 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/test/groovy/pl/tlinkowski/unij/service/collect/guava/GuavaUnmodifiableListFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.guava 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableListFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class GuavaUnmodifiableListFactorySpec extends UnmodifiableListFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new GuavaUnmodifiableListFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/test/groovy/pl/tlinkowski/unij/service/collect/guava/GuavaUnmodifiableMapFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.guava 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableMapFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class GuavaUnmodifiableMapFactorySpec extends UnmodifiableMapFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new GuavaUnmodifiableMapFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.guava/src/test/groovy/pl/tlinkowski/unij/service/collect/guava/GuavaUnmodifiableSetFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.guava 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableSetFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class GuavaUnmodifiableSetFactorySpec extends UnmodifiableSetFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new GuavaUnmodifiableSetFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/pl.tlinkowski.unij.service.collect.jdk10.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.standardJavaRelease(10) 19 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.collect.*; 19 | import pl.tlinkowski.unij.service.collect.jdk10.*; 20 | 21 | /** 22 | * Unmodifiable-{@link java.util.Collection}-related JDK-10-based bindings for UniJ. 23 | * 24 | * @author Tomasz Linkowski 25 | */ 26 | @SuppressWarnings("JavaModuleNaming") 27 | module pl.tlinkowski.unij.service.collect.jdk10 { 28 | requires pl.tlinkowski.unij.service.api; 29 | requires static pl.tlinkowski.annotation.basic; 30 | requires static auto.service.annotations; 31 | 32 | provides UnmodifiableListFactory with Jdk10UnmodifiableListFactory; 33 | provides UnmodifiableSetFactory with Jdk10UnmodifiableSetFactory; 34 | provides UnmodifiableMapFactory with Jdk10UnmodifiableMapFactory; 35 | } 36 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/main/java/pl/tlinkowski/unij/service/collect/jdk10/Jdk10UnmodifiableListFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk10; 19 | 20 | import java.util.Collection; 21 | import java.util.List; 22 | import java.util.stream.Collector; 23 | import java.util.stream.Collectors; 24 | 25 | import com.google.auto.service.AutoService; 26 | 27 | import pl.tlinkowski.unij.service.api.UniJService; 28 | import pl.tlinkowski.unij.service.api.collect.UnmodifiableListFactory; 29 | 30 | /** 31 | * Implementation of {@link UnmodifiableListFactory} that returns unmodifiable 32 | * lists introduced in JDK 10. 33 | * 34 | * @author Tomasz Linkowski 35 | */ 36 | @UniJService(priority = 10) 37 | @AutoService(UnmodifiableListFactory.class) 38 | public final class Jdk10UnmodifiableListFactory implements UnmodifiableListFactory { 39 | 40 | //region COLLECTOR 41 | @Override 42 | public Collector> collector() { 43 | return Collectors.toUnmodifiableList(); 44 | } 45 | //endregion 46 | 47 | //region COPY OF 48 | @Override 49 | public List copyOf(Collection coll) { 50 | return List.copyOf(coll); 51 | } 52 | //endregion 53 | 54 | //region OF 55 | @Override 56 | public List of() { 57 | return List.of(); 58 | } 59 | 60 | @Override 61 | public List of(E e1) { 62 | return List.of(e1); 63 | } 64 | 65 | @Override 66 | public List of(E e1, E e2) { 67 | return List.of(e1, e2); 68 | } 69 | 70 | @Override 71 | public List of(E e1, E e2, E e3) { 72 | return List.of(e1, e2, e3); 73 | } 74 | 75 | @Override 76 | public List of(E e1, E e2, E e3, E e4) { 77 | return List.of(e1, e2, e3, e4); 78 | } 79 | 80 | @Override 81 | public List of(E e1, E e2, E e3, E e4, E e5) { 82 | return List.of(e1, e2, e3, e4, e5); 83 | } 84 | 85 | @Override 86 | public List of(E e1, E e2, E e3, E e4, E e5, E e6) { 87 | return List.of(e1, e2, e3, e4, e5, e6); 88 | } 89 | 90 | @Override 91 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 92 | return List.of(e1, e2, e3, e4, e5, e6, e7); 93 | } 94 | 95 | @Override 96 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 97 | return List.of(e1, e2, e3, e4, e5, e6, e7, e8); 98 | } 99 | 100 | @Override 101 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 102 | return List.of(e1, e2, e3, e4, e5, e6, e7, e8, e9); 103 | } 104 | 105 | @SuppressWarnings("PMD.ExcessiveParameterList") 106 | @Override 107 | public List of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 108 | return List.of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); 109 | } 110 | 111 | @SafeVarargs 112 | @Override 113 | public final List of(E... elements) { 114 | return List.of(elements); 115 | } 116 | //endregion 117 | } 118 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/main/java/pl/tlinkowski/unij/service/collect/jdk10/Jdk10UnmodifiableSetFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk10; 19 | 20 | import java.util.Collection; 21 | import java.util.Set; 22 | import java.util.stream.Collector; 23 | import java.util.stream.Collectors; 24 | 25 | import com.google.auto.service.AutoService; 26 | 27 | import pl.tlinkowski.unij.service.api.UniJService; 28 | import pl.tlinkowski.unij.service.api.collect.UnmodifiableSetFactory; 29 | 30 | /** 31 | * Implementation of {@link UnmodifiableSetFactory} that returns unmodifiable 32 | * sets introduced in JDK 10. 33 | * 34 | * @author Tomasz Linkowski 35 | */ 36 | @UniJService(priority = 10) 37 | @AutoService(UnmodifiableSetFactory.class) 38 | public final class Jdk10UnmodifiableSetFactory implements UnmodifiableSetFactory { 39 | 40 | //region COLLECTOR 41 | @Override 42 | public Collector> collector() { 43 | return Collectors.toUnmodifiableSet(); 44 | } 45 | //endregion 46 | 47 | //region COPY OF 48 | @Override 49 | public Set copyOf(Collection coll) { 50 | return Set.copyOf(coll); 51 | } 52 | //endregion 53 | 54 | //region OF 55 | @Override 56 | public Set of() { 57 | return Set.of(); 58 | } 59 | 60 | @Override 61 | public Set of(E e1) { 62 | return Set.of(e1); 63 | } 64 | 65 | @Override 66 | public Set of(E e1, E e2) { 67 | return Set.of(e1, e2); 68 | } 69 | 70 | @Override 71 | public Set of(E e1, E e2, E e3) { 72 | return Set.of(e1, e2, e3); 73 | } 74 | 75 | @Override 76 | public Set of(E e1, E e2, E e3, E e4) { 77 | return Set.of(e1, e2, e3, e4); 78 | } 79 | 80 | @Override 81 | public Set of(E e1, E e2, E e3, E e4, E e5) { 82 | return Set.of(e1, e2, e3, e4, e5); 83 | } 84 | 85 | @Override 86 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6) { 87 | return Set.of(e1, e2, e3, e4, e5, e6); 88 | } 89 | 90 | @Override 91 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) { 92 | return Set.of(e1, e2, e3, e4, e5, e6, e7); 93 | } 94 | 95 | @Override 96 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { 97 | return Set.of(e1, e2, e3, e4, e5, e6, e7, e8); 98 | } 99 | 100 | @Override 101 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { 102 | return Set.of(e1, e2, e3, e4, e5, e6, e7, e8, e9); 103 | } 104 | 105 | @SuppressWarnings("PMD.ExcessiveParameterList") 106 | @Override 107 | public Set of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { 108 | return Set.of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); 109 | } 110 | 111 | @SafeVarargs 112 | @Override 113 | public final Set of(E... elements) { 114 | return Set.of(elements); 115 | } 116 | //endregion 117 | } 118 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/main/java/pl/tlinkowski/unij/service/collect/jdk10/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ {@link java.util.Collection}-factory service implementations based on JDK 10. 20 | * 21 | * @author Tomasz Linkowski 22 | * @see java.util.ServiceLoader 23 | */ 24 | @NonNullPackage 25 | package pl.tlinkowski.unij.service.collect.jdk10; 26 | 27 | import pl.tlinkowski.annotation.basic.NonNullPackage; 28 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk10/Jdk10UnmodifiableListFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk10 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableListFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk10UnmodifiableListFactorySpec extends UnmodifiableListFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk10UnmodifiableListFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk10/Jdk10UnmodifiableMapFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk10 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableMapFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk10UnmodifiableMapFactorySpec extends UnmodifiableMapFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk10UnmodifiableMapFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk10/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk10/Jdk10UnmodifiableSetFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk10 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableSetFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk10UnmodifiableSetFactorySpec extends UnmodifiableSetFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk10UnmodifiableSetFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/pl.tlinkowski.unij.service.collect.jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | superpom.useLombok = true 21 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.collect.*; 19 | import pl.tlinkowski.unij.service.collect.jdk8.*; 20 | 21 | /** 22 | * Unmodifiable-{@link java.util.Collection}-related JDK-8-based bindings for UniJ. 23 | * 24 | * @author Tomasz Linkowski 25 | */ 26 | @SuppressWarnings("JavaModuleNaming") 27 | module pl.tlinkowski.unij.service.collect.jdk8 { 28 | requires pl.tlinkowski.unij.service.api; 29 | requires static pl.tlinkowski.annotation.basic; 30 | requires static auto.service.annotations; 31 | requires static lombok; 32 | 33 | provides UnmodifiableListFactory with Jdk8UnmodifiableListFactory; 34 | provides UnmodifiableSetFactory with Jdk8UnmodifiableSetFactory; 35 | provides UnmodifiableMapFactory with Jdk8UnmodifiableMapFactory; 36 | } 37 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/src/main/java/pl/tlinkowski/unij/service/collect/jdk8/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ {@link java.util.Collection}-factory service implementations based on JDK 8. 20 | * 21 | * @author Tomasz Linkowski 22 | * @see java.util.ServiceLoader 23 | */ 24 | @NonNullPackage 25 | package pl.tlinkowski.unij.service.collect.jdk8; 26 | 27 | import pl.tlinkowski.annotation.basic.NonNullPackage; 28 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk8/Jdk8UnmodifiableListFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk8 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableListFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk8UnmodifiableListFactorySpec extends UnmodifiableListFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk8UnmodifiableListFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk8/Jdk8UnmodifiableMapFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk8 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableMapFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk8UnmodifiableMapFactorySpec extends UnmodifiableMapFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk8UnmodifiableMapFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/collect/pl.tlinkowski.unij.service.collect.jdk8/src/test/groovy/pl/tlinkowski/unij/service/collect/jdk8/Jdk8UnmodifiableSetFactorySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.collect.jdk8 19 | 20 | import pl.tlinkowski.unij.test.service.collect.UnmodifiableSetFactorySpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk8UnmodifiableSetFactorySpec extends UnmodifiableSetFactorySpec { 26 | 27 | def setupSpec() { 28 | factory = new Jdk8UnmodifiableSetFactory() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11/pl.tlinkowski.unij.service.misc.jdk11.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.standardJavaRelease(11) 19 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 19 | import pl.tlinkowski.unij.service.misc.jdk11.Jdk11MiscellaneousApiProvider; 20 | 21 | /** 22 | * Miscellaneous JDK-11-based bindings for UniJ. 23 | * 24 | * @author Tomasz Linkowski 25 | */ 26 | @SuppressWarnings("JavaModuleNaming") 27 | module pl.tlinkowski.unij.service.misc.jdk11 { 28 | requires pl.tlinkowski.unij.service.api; 29 | requires static pl.tlinkowski.annotation.basic; 30 | requires static auto.service.annotations; 31 | 32 | provides MiscellaneousApiProvider with Jdk11MiscellaneousApiProvider; 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11/src/main/java/pl/tlinkowski/unij/service/misc/jdk11/Jdk11MiscellaneousApiProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.misc.jdk11; 19 | 20 | import java.util.function.Function; 21 | import java.util.function.Predicate; 22 | import java.util.stream.*; 23 | 24 | import com.google.auto.service.AutoService; 25 | 26 | import pl.tlinkowski.unij.service.api.UniJService; 27 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 28 | 29 | /** 30 | * Implementation of {@link MiscellaneousApiProvider} that delegates to original JDK 11 APIs. 31 | * 32 | * @author Tomasz Linkowski 33 | */ 34 | @UniJService(priority = 10) 35 | @AutoService(MiscellaneousApiProvider.class) 36 | public final class Jdk11MiscellaneousApiProvider implements MiscellaneousApiProvider { 37 | 38 | //region COLLECTORS 39 | @Override 40 | public Collector flatMappingCollector(Function> mapper, 41 | Collector downstream) { 42 | return Collectors.flatMapping(mapper, downstream); 43 | } 44 | 45 | @Override 46 | public Collector filteringCollector(Predicate predicate, 47 | Collector downstream) { 48 | return Collectors.filtering(predicate, downstream); 49 | } 50 | //endregion 51 | } 52 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11/src/main/java/pl/tlinkowski/unij/service/misc/jdk11/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ miscellaneous service implementations based on JDK 11. 20 | * 21 | * @author Tomasz Linkowski 22 | */ 23 | @NonNullPackage 24 | package pl.tlinkowski.unij.service.misc.jdk11; 25 | 26 | import pl.tlinkowski.annotation.basic.NonNullPackage; 27 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk11/src/test/groovy/pl/tlinkowski/unij/service/misc/jdk11/Jdk11MiscellaneousApiProviderSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.misc.jdk11 19 | 20 | import pl.tlinkowski.unij.test.service.misc.MiscellaneousApiProviderSpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk11MiscellaneousApiProviderSpec extends MiscellaneousApiProviderSpec { 26 | 27 | def setupSpec() { 28 | provider = new Jdk11MiscellaneousApiProvider() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8/pl.tlinkowski.unij.service.misc.jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 19 | import pl.tlinkowski.unij.service.misc.jdk8.Jdk8MiscellaneousApiProvider; 20 | 21 | /** 22 | * Miscellaneous JDK-8-based bindings for UniJ. 23 | * 24 | * @author Tomasz Linkowski 25 | */ 26 | @SuppressWarnings("JavaModuleNaming") 27 | module pl.tlinkowski.unij.service.misc.jdk8 { 28 | requires pl.tlinkowski.unij.service.api; 29 | requires static pl.tlinkowski.annotation.basic; 30 | requires static auto.service.annotations; 31 | 32 | provides MiscellaneousApiProvider with Jdk8MiscellaneousApiProvider; 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8/src/main/java/pl/tlinkowski/unij/service/misc/jdk8/Jdk8MiscellaneousApiProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.misc.jdk8; 19 | 20 | import java.util.function.*; 21 | import java.util.stream.*; 22 | 23 | import com.google.auto.service.AutoService; 24 | 25 | import pl.tlinkowski.unij.service.api.UniJService; 26 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider; 27 | 28 | /** 29 | * Implementation of {@link MiscellaneousApiProvider} that delegates to original JDK 11 APIs. 30 | * 31 | * @author Tomasz Linkowski 32 | */ 33 | @UniJService(priority = 40) 34 | @AutoService(MiscellaneousApiProvider.class) 35 | public final class Jdk8MiscellaneousApiProvider implements MiscellaneousApiProvider { 36 | 37 | //region COLLECTORS 38 | 39 | /** 40 | * Based on {@link Collectors#flatMapping(Function, Collector)}. 41 | */ 42 | @Override 43 | public Collector flatMappingCollector(Function> mapper, 44 | Collector downstream) { 45 | BiConsumer accumulator = downstream.accumulator(); 46 | BiConsumer newAccumulator = (a, t) -> { 47 | try (Stream mappedStream = mapper.apply(t)) { 48 | if (mappedStream != null) { 49 | mappedStream.sequential().forEach(u -> accumulator.accept(a, u)); 50 | } 51 | } 52 | }; 53 | return collectorWithNewAccumulator(downstream, newAccumulator); 54 | } 55 | 56 | /** 57 | * Based on {@link Collectors#filtering(Predicate, Collector)}. 58 | */ 59 | @Override 60 | public Collector filteringCollector(Predicate predicate, 61 | Collector downstream) { 62 | BiConsumer accumulator = downstream.accumulator(); 63 | BiConsumer newAccumulator = (a, t) -> { 64 | if (predicate.test(t)) { 65 | accumulator.accept(a, t); 66 | } 67 | }; 68 | return collectorWithNewAccumulator(downstream, newAccumulator); 69 | } 70 | 71 | private Collector collectorWithNewAccumulator(Collector collector, 72 | BiConsumer newAccumulator) { 73 | return Collector.of( 74 | collector.supplier(), newAccumulator, collector.combiner(), collector.finisher(), 75 | collector.characteristics().toArray(new Collector.Characteristics[0]) 76 | ); 77 | } 78 | //endregion 79 | } 80 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8/src/main/java/pl/tlinkowski/unij/service/misc/jdk8/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * UniJ miscellaneous service implementations based on JDK 8. 20 | * 21 | * @author Tomasz Linkowski 22 | */ 23 | @NonNullPackage 24 | package pl.tlinkowski.unij.service.misc.jdk8; 25 | 26 | import pl.tlinkowski.annotation.basic.NonNullPackage; 27 | -------------------------------------------------------------------------------- /subprojects/bindings/misc/pl.tlinkowski.unij.service.misc.jdk8/src/test/groovy/pl/tlinkowski/unij/service/misc/jdk8/Jdk8MiscellaneousApiProviderSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.service.misc.jdk8 19 | 20 | import pl.tlinkowski.unij.test.service.misc.MiscellaneousApiProviderSpec 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk8MiscellaneousApiProviderSpec extends MiscellaneousApiProviderSpec { 26 | 27 | def setupSpec() { 28 | provider = new Jdk8MiscellaneousApiProvider() 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.eclipse_jdk8/pl.tlinkowski.unij.bundle.eclipse_jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | dependencies { 21 | implementation(project(":pl.tlinkowski.unij.service.collect.eclipse")) 22 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 23 | 24 | val eclipseCollectionsHighVersion: String by project // https://www.eclipse.org/collections/ 25 | testRuntimeOnly(group = "org.eclipse.collections", name = "eclipse-collections", version = eclipseCollectionsHighVersion) 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.eclipse_jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * A bundle of bindings for UniJ: 20 | *
    21 | *
  • unmodifiable-{@link java.util.Collection}-related 22 | * Eclipse-based bindings
  • 23 | *
  • miscellaneous JDK-8-based bindings
  • 24 | *
25 | * 26 | * @author Tomasz Linkowski 27 | */ 28 | @SuppressWarnings("JavaModuleNaming") 29 | module pl.tlinkowski.unij.bundle.eclipse_jdk8 { 30 | requires transitive pl.tlinkowski.unij.api; 31 | 32 | requires pl.tlinkowski.unij.service.collect.eclipse; 33 | requires pl.tlinkowski.unij.service.misc.jdk8; 34 | } 35 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.eclipse_jdk8/src/test/groovy/pl/tlinkowski/unij/bundle/eclipse_jdk8/EclipseJdk8BundleTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.bundle.eclipse_jdk8 19 | 20 | import pl.tlinkowski.unij.test.bundle.UniJBundleTest 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EclipseJdk8BundleTest extends UniJBundleTest { 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.guava_jdk8/pl.tlinkowski.unij.bundle.guava_jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | dependencies { 21 | implementation(project(":pl.tlinkowski.unij.service.collect.guava")) 22 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 23 | 24 | val guavaHighVersion: String by project // https://github.com/google/guava 25 | testRuntimeOnly(group = "com.google.guava", name = "guava", version = guavaHighVersion) 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.guava_jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * A bundle of bindings for UniJ: 20 | *
    21 | *
  • unmodifiable-{@link java.util.Collection}-related Guava-based 22 | * bindings
  • 23 | *
  • miscellaneous JDK-8-based bindings
  • 24 | *
25 | * 26 | * @author Tomasz Linkowski 27 | */ 28 | @SuppressWarnings("JavaModuleNaming") 29 | module pl.tlinkowski.unij.bundle.guava_jdk8 { 30 | requires transitive pl.tlinkowski.unij.api; 31 | 32 | requires pl.tlinkowski.unij.service.collect.guava; 33 | requires pl.tlinkowski.unij.service.misc.jdk8; 34 | } 35 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.guava_jdk8/src/test/groovy/pl/tlinkowski/unij/bundle/guava_jdk8/GuavaJdk8BundleTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.bundle.guava_jdk8 19 | 20 | import pl.tlinkowski.unij.test.bundle.UniJBundleTest 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class GuavaJdk8BundleTest extends UniJBundleTest { 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk11/pl.tlinkowski.unij.bundle.jdk11.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.standardJavaRelease(11) 19 | 20 | dependencies { 21 | implementation(project(":pl.tlinkowski.unij.service.collect.jdk10")) 22 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk11")) 23 | } 24 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk11/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * A bundle of bindings for UniJ: 20 | *
    21 | *
  • unmodifiable-{@link java.util.Collection}-related JDK-10-based bindings
  • 22 | *
  • miscellaneous JDK-11-based bindings
  • 23 | *
24 | * 25 | * @author Tomasz Linkowski 26 | */ 27 | @SuppressWarnings("JavaModuleNaming") 28 | module pl.tlinkowski.unij.bundle.jdk11 { 29 | requires transitive pl.tlinkowski.unij.api; 30 | 31 | requires pl.tlinkowski.unij.service.collect.jdk10; 32 | requires pl.tlinkowski.unij.service.misc.jdk11; 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk11/src/test/groovy/pl/tlinkowski/unij/bundle/jdk11/Jdk11BundleTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.bundle.jdk11 19 | 20 | import pl.tlinkowski.unij.test.bundle.UniJBundleTest 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk11BundleTest extends UniJBundleTest { 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk8/pl.tlinkowski.unij.bundle.jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | dependencies { 21 | implementation(project(":pl.tlinkowski.unij.service.collect.jdk8")) 22 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 23 | } 24 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * A bundle of bindings for UniJ: 20 | *
    21 | *
  • unmodifiable-{@link java.util.Collection}-related JDK-8-based bindings
  • 22 | *
  • miscellaneous JDK-8-based bindings
  • 23 | *
24 | * 25 | * @author Tomasz Linkowski 26 | */ 27 | @SuppressWarnings("JavaModuleNaming") 28 | module pl.tlinkowski.unij.bundle.jdk8 { 29 | requires transitive pl.tlinkowski.unij.api; 30 | 31 | requires pl.tlinkowski.unij.service.collect.jdk8; 32 | requires pl.tlinkowski.unij.service.misc.jdk8; 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/bundles/pl.tlinkowski.unij.bundle.jdk8/src/test/groovy/pl/tlinkowski/unij/bundle/jdk8/Jdk8BundleTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.bundle.jdk8 19 | 20 | import pl.tlinkowski.unij.test.bundle.UniJBundleTest 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class Jdk8BundleTest extends UniJBundleTest { 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/pl.tlinkowski.unij.test.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | config { 19 | groovydoc { 20 | enabled = true 21 | replaceJavadoc = true 22 | } 23 | } 24 | 25 | superpom.isTestProject = true 26 | 27 | //region REMOVE REDUNDANT KOTLIN-STDLIB DEPENDENCY ADDED BY SUPERPOM PLUGIN 28 | afterEvaluate { 29 | configurations.api { 30 | dependencies.removeIf { it.name == "kotlin-stdlib-jdk8" } 31 | } 32 | } 33 | //endregion 34 | 35 | dependencies { 36 | val slf4jVersion: String by project // https://www.slf4j.org/ 37 | 38 | api(project(":pl.tlinkowski.unij.service.api")) 39 | implementation(project(":pl.tlinkowski.unij.api")) // for UniJBundleTest 40 | runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = slf4jVersion) 41 | } 42 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/src/main/groovy/pl/tlinkowski/unij/test/bundle/UniJBundleTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.test.bundle 19 | 20 | import spock.lang.Specification 21 | 22 | import java.util.stream.Collectors 23 | 24 | import pl.tlinkowski.unij.api.* 25 | 26 | /** 27 | * Test that should be extended by every bundle. 28 | * 29 | * This test verifies that a bundle has proper runtime dependencies. 30 | * 31 | * @author Tomasz Linkowski 32 | */ 33 | abstract class UniJBundleTest extends Specification { 34 | 35 | def "UnmodifiableListFactory implementation found"() { 36 | when: 37 | UniLists.of() 38 | then: 39 | noExceptionThrown() 40 | } 41 | 42 | def "UnmodifiableSetFactory implementation found"() { 43 | when: 44 | UniSets.of() 45 | then: 46 | noExceptionThrown() 47 | } 48 | 49 | def "UnmodifiableMapFactory implementation found"() { 50 | when: 51 | UniMaps.of() 52 | then: 53 | noExceptionThrown() 54 | } 55 | 56 | def "MiscellaneousApiProvider implementation found"() { 57 | when: 58 | UniCollectors.filtering({ true }, Collectors.toList()) 59 | then: 60 | noExceptionThrown() 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/src/main/groovy/pl/tlinkowski/unij/test/bundle/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.test.bundle; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/src/main/groovy/pl/tlinkowski/unij/test/service/collect/UnmodifiableCollectionSpecHelper.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.test.service.collect 19 | 20 | import groovy.transform.PackageScope 21 | 22 | import java.util.stream.Collector 23 | 24 | /** 25 | * Helper class for the {@link List}/{@link Set} specs. 26 | * 27 | * Includes data pipes: http://spockframework.org/spock/docs/1.3/data_driven_testing.html#_data_pipes 28 | * 29 | * @author Tomasz Linkowski 30 | */ 31 | @PackageScope 32 | class UnmodifiableCollectionSpecHelper { 33 | 34 | //region DATA PIPES 35 | static List> lists() { 36 | [ 37 | [], 38 | [1], 39 | [1, 2], 40 | [1, 2, 3], 41 | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 42 | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 43 | ] 44 | } 45 | 46 | static List> listsWithNull() { 47 | [ 48 | [null], 49 | [1, null], 50 | [1, 2, null], 51 | [1, 2, 3, 4, 5, 6, 7, 8, 9, null], 52 | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, null] 53 | ] 54 | } 55 | //endregion 56 | 57 | //region ARGS 58 | static List args(int size) { 59 | size == 0 ? [] : 1..size 60 | } 61 | 62 | static List argsWithNull(int size, int nullIndex) { 63 | Integer[] args = args(size) 64 | args[nullIndex] = null 65 | args 66 | } 67 | //endregion 68 | 69 | //region COLLECT 70 | static > C collect(Collector collector, List list) { 71 | list.stream().collect(collector) 72 | } 73 | //endregion 74 | } 75 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/src/main/groovy/pl/tlinkowski/unij/test/service/collect/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * Test classes (specifications) for UniJ {@link java.util.Collection}-factory services. 20 | * 21 | * @author Tomasz Linkowski 22 | * @see java.util.ServiceLoader 23 | */ 24 | @NonNullPackage 25 | package pl.tlinkowski.unij.test.service.collect; 26 | 27 | import pl.tlinkowski.annotation.basic.NonNullPackage; 28 | -------------------------------------------------------------------------------- /subprojects/pl.tlinkowski.unij.test/src/main/groovy/pl/tlinkowski/unij/test/service/misc/MiscellaneousApiProviderSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.test.service.misc 19 | 20 | import spock.lang.Shared 21 | import spock.lang.Specification 22 | 23 | import java.util.stream.Collectors 24 | import java.util.stream.Stream 25 | 26 | import pl.tlinkowski.unij.service.api.misc.MiscellaneousApiProvider 27 | 28 | /** 29 | * Specification for {@link MiscellaneousApiProvider}. 30 | * 31 | * Inheriting classes should initialize {@code provider} in the {@code setupSpec} method. 32 | * 33 | * @author Tomasz Linkowski 34 | */ 35 | abstract class MiscellaneousApiProviderSpec extends Specification { 36 | 37 | @Shared 38 | protected MiscellaneousApiProvider provider 39 | 40 | //region COLLECTORS: STANDARD CONTRACT (corresponds to MISCELLANEOUS region of UniCollectorsSpec) 41 | def "flatMappingCollector"(List list, List expected) { 42 | when: 43 | def collector = provider.flatMappingCollector({ Stream.of(it, -it) }, Collectors.toList()) 44 | then: 45 | list.stream().collect(collector) == expected 46 | where: 47 | list | expected 48 | [] | [] 49 | [1] | [1, -1] 50 | [-1] | [-1, 1] 51 | [1, 2] | [1, -1, 2, -2] 52 | [1, 2, 3] | [1, -1, 2, -2, 3, -3] 53 | } 54 | 55 | def "filteringCollector"(List list, List expected) { 56 | when: 57 | def collector = provider.filteringCollector({ it % 2 != 0 }, Collectors.toList()) 58 | then: 59 | list.stream().collect(collector) == expected 60 | where: 61 | list | expected 62 | [] | [] 63 | [1] | [1] 64 | [2] | [] 65 | [1, 2] | [1] 66 | [1, 2, 3] | [1, 3] 67 | } 68 | //endregion 69 | 70 | //region COLLECTORS: SPECIAL CASES 71 | def "flatMappingCollector handles null as empty stream"() { 72 | when: 73 | def collector = provider.flatMappingCollector({ null }, Collectors.toList()) 74 | then: 75 | [1, 2, 3].stream().collect(collector) == [] 76 | } 77 | //endregion 78 | } 79 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk11/pl.tlinkowski.unij.sample.enduser.jdk11.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.EndUsage" 24 | } 25 | 26 | modularity.standardJavaRelease(11) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.bundle.jdk11")) 30 | } 31 | 32 | tasks { 33 | check { 34 | // `run` fails with "java.lang.module.FindException: Module pl.tlinkowski.unij.sample.enduser.jdk11 not found" 35 | // https://github.com/java9-modularity/gradle-modules-plugin/issues/118 36 | // dependsOn(run) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk11/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.enduser.jdk11 { 22 | requires pl.tlinkowski.unij.bundle.jdk11; 23 | requires static pl.tlinkowski.annotation.basic; 24 | } 25 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk11/src/main/java/pl/tlinkowski/unij/sample/enduser/jdk11/EndUsage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.enduser.jdk11; 19 | 20 | import java.util.List; 21 | 22 | import pl.tlinkowski.unij.api.UniLists; 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | public final class EndUsage { 28 | 29 | public static void main(String[] args) { 30 | System.out.println(names()); 31 | } 32 | 33 | public static List names() { 34 | return UniLists.of("foo", "bar"); 35 | } 36 | 37 | private EndUsage() { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk11/src/main/java/pl/tlinkowski/unij/sample/enduser/jdk11/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.enduser.jdk11; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk11/src/test/groovy/pl/tlinkowski/unij/sample/enduser/jdk11/EndUsageSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.enduser.jdk11 19 | 20 | import spock.lang.Specification 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EndUsageSpec extends Specification { 26 | 27 | def names() { 28 | expect: 29 | EndUsage.names() == List.of("foo", "bar") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk8/pl.tlinkowski.unij.sample.enduser.jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.EndUsage" 24 | } 25 | 26 | modularity.mixedJavaRelease(8) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.bundle.jdk8")) 30 | } 31 | 32 | tasks { 33 | check { 34 | dependsOn(run) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.enduser.jdk8 { 22 | requires pl.tlinkowski.unij.bundle.jdk8; 23 | requires static pl.tlinkowski.annotation.basic; 24 | } 25 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk8/src/main/java/pl/tlinkowski/unij/sample/enduser/jdk8/EndUsage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.enduser.jdk8; 19 | 20 | import java.util.List; 21 | 22 | import pl.tlinkowski.unij.api.UniLists; 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | public final class EndUsage { 28 | 29 | public static void main(String[] args) { 30 | System.out.println(names()); 31 | } 32 | 33 | public static List names() { 34 | return UniLists.of("foo", "bar"); 35 | } 36 | 37 | private EndUsage() { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk8/src/main/java/pl/tlinkowski/unij/sample/enduser/jdk8/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.enduser.jdk8; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/enduser/pl.tlinkowski.unij.sample.enduser.jdk8/src/test/groovy/pl/tlinkowski/unij/sample/enduser/jdk8/EndUsageSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.enduser.jdk8 19 | 20 | import spock.lang.Specification 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | class EndUsageSpec extends Specification { 26 | 27 | def names() { 28 | expect: 29 | EndUsage.names() == List.of("foo", "bar") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.eclipse/pl.tlinkowski.unij.sample.lib.usage.eclipse.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.SampleLogicMain" 24 | } 25 | 26 | modularity.mixedJavaRelease(8) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.sample.lib")) 30 | 31 | implementation(project(":pl.tlinkowski.unij.service.collect.eclipse")) 32 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 33 | 34 | val eclipseCollectionsHighVersion: String by project // https://www.eclipse.org/collections/ 35 | runtimeOnly(group = "org.eclipse.collections", name = "eclipse-collections", version = eclipseCollectionsHighVersion) 36 | } 37 | 38 | tasks { 39 | check { 40 | dependsOn(run) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.eclipse/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.lib.usage.eclipse { 22 | requires pl.tlinkowski.unij.sample.lib; 23 | 24 | requires pl.tlinkowski.unij.service.collect.eclipse; 25 | requires pl.tlinkowski.unij.service.misc.jdk8; 26 | 27 | requires static pl.tlinkowski.annotation.basic; 28 | } 29 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.eclipse/src/main/java/pl/tlinkowski/unij/sample/lib/usage/eclipse/SampleLogicMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.eclipse; 19 | 20 | import pl.tlinkowski.unij.sample.lib.SampleLogic; 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | public final class SampleLogicMain { 26 | 27 | public static void main(String[] args) { 28 | System.out.println(SampleLogic.fooBar()); 29 | } 30 | 31 | private SampleLogicMain() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.eclipse/src/main/java/pl/tlinkowski/unij/sample/lib/usage/eclipse/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.lib.usage.eclipse; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.eclipse/src/test/groovy/pl/tlinkowski/unij/sample/lib/usage/eclipse/SampleLogicSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.eclipse 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.sample.lib.SampleLogic 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class SampleLogicSpec extends Specification { 28 | 29 | def foo() { 30 | expect: 31 | SampleLogic.fooBar() == 212 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.guava/pl.tlinkowski.unij.sample.lib.usage.guava.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.SampleLogicMain" 24 | } 25 | 26 | modularity.mixedJavaRelease(8) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.sample.lib")) 30 | 31 | implementation(project(":pl.tlinkowski.unij.service.collect.guava")) 32 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 33 | 34 | val guavaHighVersion: String by project // https://github.com/google/guava 35 | runtimeOnly(group = "com.google.guava", name = "guava", version = guavaHighVersion) 36 | } 37 | 38 | tasks { 39 | check { 40 | dependsOn(run) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.guava/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.lib.usage.guava { 22 | requires pl.tlinkowski.unij.sample.lib; 23 | 24 | requires pl.tlinkowski.unij.service.collect.guava; 25 | requires pl.tlinkowski.unij.service.misc.jdk8; 26 | 27 | requires static pl.tlinkowski.annotation.basic; 28 | } 29 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.guava/src/main/java/pl/tlinkowski/unij/sample/lib/usage/guava/SampleLogicMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.guava; 19 | 20 | import pl.tlinkowski.unij.sample.lib.SampleLogic; 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | public final class SampleLogicMain { 26 | 27 | public static void main(String[] args) { 28 | System.out.println(SampleLogic.fooBar()); 29 | } 30 | 31 | private SampleLogicMain() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.guava/src/main/java/pl/tlinkowski/unij/sample/lib/usage/guava/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.lib.usage.guava; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.guava/src/test/groovy/pl/tlinkowski/unij/sample/lib/usage/guava/SampleLogicSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.guava 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.sample.lib.SampleLogic 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class SampleLogicSpec extends Specification { 28 | 29 | def foo() { 30 | expect: 31 | SampleLogic.fooBar() == 212 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk11/pl.tlinkowski.unij.sample.lib.usage.jdk11.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.SampleLogicMain" 24 | } 25 | 26 | modularity.standardJavaRelease(11) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.sample.lib")) 30 | 31 | implementation(project(":pl.tlinkowski.unij.service.collect.jdk10")) 32 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk11")) 33 | } 34 | 35 | tasks { 36 | check { 37 | // `run` fails with "java.lang.module.FindException: Module pl.tlinkowski.unij.sample.lib.usage.jdk11 not found" 38 | // https://github.com/java9-modularity/gradle-modules-plugin/issues/118 39 | // dependsOn(run) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk11/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.lib.usage.jdk11 { 22 | requires pl.tlinkowski.unij.sample.lib; 23 | 24 | requires pl.tlinkowski.unij.service.collect.jdk10; 25 | requires pl.tlinkowski.unij.service.misc.jdk11; 26 | 27 | requires static pl.tlinkowski.annotation.basic; 28 | } 29 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk11/src/main/java/pl/tlinkowski/unij/sample/lib/usage/jdk11/SampleLogicMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.jdk11; 19 | 20 | import pl.tlinkowski.unij.sample.lib.SampleLogic; 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | public final class SampleLogicMain { 26 | 27 | public static void main(String[] args) { 28 | System.out.println(SampleLogic.fooBar()); 29 | } 30 | 31 | private SampleLogicMain() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk11/src/main/java/pl/tlinkowski/unij/sample/lib/usage/jdk11/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.lib.usage.jdk11; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk11/src/test/groovy/pl/tlinkowski/unij/sample/lib/usage/jdk11/SampleLogicSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.jdk11 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.sample.lib.SampleLogic 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class SampleLogicSpec extends Specification { 28 | 29 | def foo() { 30 | expect: 31 | SampleLogic.fooBar() == 212 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk8/pl.tlinkowski.unij.sample.lib.usage.jdk8.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | plugins { 19 | application 20 | } 21 | 22 | application { 23 | mainClassName = "${project.name}/${project.name}.SampleLogicMain" 24 | } 25 | 26 | modularity.mixedJavaRelease(8) 27 | 28 | dependencies { 29 | implementation(project(":pl.tlinkowski.unij.sample.lib")) 30 | 31 | implementation(project(":pl.tlinkowski.unij.service.collect.jdk8")) 32 | implementation(project(":pl.tlinkowski.unij.service.misc.jdk8")) 33 | } 34 | 35 | tasks { 36 | check { 37 | dependsOn(run) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk8/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.lib.usage.jdk8 { 22 | requires pl.tlinkowski.unij.sample.lib; 23 | 24 | requires pl.tlinkowski.unij.service.collect.jdk8; 25 | requires pl.tlinkowski.unij.service.misc.jdk8; 26 | 27 | requires static pl.tlinkowski.annotation.basic; 28 | } 29 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk8/src/main/java/pl/tlinkowski/unij/sample/lib/usage/jdk8/SampleLogicMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.jdk8; 19 | 20 | import pl.tlinkowski.unij.sample.lib.SampleLogic; 21 | 22 | /** 23 | * @author Tomasz Linkowski 24 | */ 25 | public final class SampleLogicMain { 26 | 27 | public static void main(String[] args) { 28 | System.out.println(SampleLogic.fooBar()); 29 | } 30 | 31 | private SampleLogicMain() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk8/src/main/java/pl/tlinkowski/unij/sample/lib/usage/jdk8/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.lib.usage.jdk8; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib.usage.jdk8/src/test/groovy/pl/tlinkowski/unij/sample/lib/usage/jdk8/SampleLogicSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib.usage.jdk8 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.sample.lib.SampleLogic 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class SampleLogicSpec extends Specification { 28 | 29 | def foo() { 30 | expect: 31 | SampleLogic.fooBar() == 212 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib/pl.tlinkowski.unij.sample.lib.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | modularity.mixedJavaRelease(8) 19 | 20 | dependencies { 21 | implementation(project(":pl.tlinkowski.unij.api")) 22 | } 23 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | module pl.tlinkowski.unij.sample.lib { 22 | exports pl.tlinkowski.unij.sample.lib; 23 | 24 | requires pl.tlinkowski.unij.api; 25 | requires static pl.tlinkowski.annotation.basic; 26 | } 27 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib/src/main/java/pl/tlinkowski/unij/sample/lib/SampleLogic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib; 19 | 20 | import java.util.*; 21 | 22 | import pl.tlinkowski.unij.api.*; 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | public final class SampleLogic { 28 | 29 | private final Map map = UniMaps.of( 30 | "a", "b", 31 | "c", "de" 32 | ); 33 | 34 | public static int fooBar() { 35 | return new SampleLogic().foo("bar"); 36 | } 37 | 38 | /** 39 | * Computes {@code foo} from given {@code bar}. 40 | */ 41 | public int foo(String bar) { 42 | String baz = replaceAll(bar); 43 | List list = letters(baz); 44 | Set set = UniSets.copyOf(list); 45 | return sum(set); 46 | } 47 | 48 | private String replaceAll(String string) { 49 | return map.entrySet().stream().reduce( 50 | string, (str, entry) -> str.replace(entry.getKey(), entry.getValue()), SampleLogic::combineUnsupported 51 | ); 52 | } 53 | 54 | private static List letters(String string) { 55 | return string.codePoints().boxed().collect(UniCollectors.filtering( 56 | Character::isLetter, UniCollectors.toUnmodifiableList() 57 | )); 58 | } 59 | 60 | private static int sum(Collection ints) { 61 | return ints.stream().mapToInt(Integer::intValue).sum(); 62 | } 63 | 64 | private static T combineUnsupported(T t1, T t2) { 65 | throw new UnsupportedOperationException(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib/src/main/java/pl/tlinkowski/unij/sample/lib/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | /** 19 | * @author Tomasz Linkowski 20 | */ 21 | @NonNullPackage 22 | package pl.tlinkowski.unij.sample.lib; 23 | 24 | import pl.tlinkowski.annotation.basic.NonNullPackage; 25 | -------------------------------------------------------------------------------- /subprojects/samples/lib/pl.tlinkowski.unij.sample.lib/src/test/groovy/pl/tlinkowski/unij/sample/lib/SampleLogicSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2018-2021 Tomasz Linkowski. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package pl.tlinkowski.unij.sample.lib 19 | 20 | import spock.lang.Specification 21 | 22 | import pl.tlinkowski.unij.api.UniJException 23 | 24 | /** 25 | * @author Tomasz Linkowski 26 | */ 27 | class SampleLogicSpec extends Specification { 28 | 29 | def fooBar() { 30 | when: 31 | SampleLogic.fooBar() 32 | then: 33 | UniJException ex = thrown() 34 | ex.message.contains('service implementation not found') 35 | } 36 | } 37 | --------------------------------------------------------------------------------