Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebhoss/generic-types
https://github.com/sebhoss/generic-types
generics java
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sebhoss/generic-types
- Owner: sebhoss
- License: cc0-1.0
- Created: 2016-01-17T16:44:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-08T17:06:51.000Z (almost 8 years ago)
- Last Synced: 2023-07-03T11:41:00.361Z (over 1 year ago)
- Topics: generics, java
- Language: Java
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.asciidoc
- Changelog: CHANGELOG.asciidoc
- Contributing: CONTRIBUTING.asciidoc
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.asciidoc
Awesome Lists containing this project
README
= Generic Types image:https://img.shields.io/badge/email-%40metio-brightgreen.svg?style=social&label=mail["Discuss on Google Groups", link="https://groups.google.com/forum/#!forum/metio"] image:https://img.shields.io/badge/irc-%23metio.wtf-brightgreen.svg?style=social&label=IRC["Chat on IRC", link="http://webchat.freenode.net/?channels=metio.wtf"]
Sebastian Hoß
:github-org: sebhoss
:project-name: generic-types
:project-group: de.xn--ho-hia.utils.types
:coverity-project: 7620
:codacy-project: 9402c820df454d3a83c697f254aeb1b3
:toc:
:toc-placement: preambleimage:https://img.shields.io/badge/license-cc%20zero-000000.svg?style=flat-square["CC Zero", link="http://creativecommons.org/publicdomain/zero/1.0/"]
pass:[]
pass:[]
image:https://reposs.herokuapp.com/?path={github-org}/{project-name}&style=flat-square["Repository size"]
image:https://www.openhub.net/p/{project-name}/widgets/project_thin_badge.gif["Open Hub statistics", link="https://www.openhub.net/p/{project-name}"]image:https://img.shields.io/travis/{github-org}/{project-name}/master.svg?style=flat-square["Build Status", link="https://travis-ci.org/{github-org}/{project-name}"]
image:https://img.shields.io/coveralls/{github-org}/{project-name}/master.svg?style=flat-square["Code Coverage", link="https://coveralls.io/github/{github-org}/{project-name}"]
image:https://img.shields.io/coverity/scan/{coverity-project}.svg?style=flat-square["Coverity Scan Result", link="https://scan.coverity.com/projects/{github-org}-{project-name}"]
image:https://img.shields.io/codacy/grade/{codacy-project}.svg?style=flat-square["Codacy Code Quality", link="https://www.codacy.com/app/mail_7/{project-name}"]
image:https://img.shields.io/badge/forkable-yes-brightgreen.svg?style=flat-square["Can this project be forked?", link="https://basicallydan.github.io/forkability/?u={github-org}&r={project-name}"]
image:https://img.shields.io/maintenance/yes/2017.svg?style=flat-square["Is this thing still maintained?"]
image:https://img.shields.io/bountysource/team/metio/activity.svg?style=flat-square["Bounties on open tickets", link="https://www.bountysource.com/teams/metio"]This https://www.java.com[Java] library provides a factory to create generic `java.lang.reflect.Type` variations, such as `Map`.
=== Features
* Factory methods to create generic types, including wildcards.
=== Development Status
All currently required feature are implemented. This project is in maintenance mode.
== Usage
[source,java]
----
// Map
final Type type = GenericTypes.generic(Map.class, Number.class, Point.class);// List
final Type type = GenericTypes.generic(List.class, Number.class);
----Super- and subtypes such as `List super Point>` or `List extends Number>` can be created in the following way:
[source,java]
----
// List super Point>
final Type type = GenericTypes.generic(List.class, GenericTypes.supertype(Point.class));// List extends Number>
final Type type = GenericTypes.generic(List.class, GenericTypes.subtype(Number.class));
----Use static imports to shorten the above calls to:
[source,java]
----
// List super Point>
final Type type = generic(List.class, supertype(Point.class));// List extends Number>
final Type type = generic(List.class, subtype(Number.class));
----and then go crazy with this:
[source,java]
----
// List>
final Type type = generic(List.class, generic(Map.class, subtype(Number.class), supertype(Point.class)));
----=== Integration
To use this project just declare the following dependency inside your POM:
[source,xml,subs="attributes,verbatim"]
----
{project-group}
{project-name}
${version.generic-types}
----
Replace `${version.generic-types}` with the pass:[latest release]. This project follows the link:http://semver.org/[semantic versioning guidelines].
=== Compatibility
This project is compatible with the following Java versions:
.Java compatibility
|===
| | 1.X.Y | 2.X.Y| Java 8
| ✓
| ✓
|===== License
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.You should have received a copy of the CC0 Public Domain Dedication along
with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.== Mirrors
* https://github.com/sebhoss/{project-name}
* https://bitbucket.org/sebhoss/{project-name}
* https://gitlab.com/sebastian.hoss/{project-name}
* http://v2.pikacode.com/sebhoss/{project-name}.java
* http://repo.or.cz/{project-name}.git