replace ohloh w/ openhub
[generic-types.git] / README.asciidoc
blob623338dda67a3ca5f0b7104558e85e21b638d2ac
1 = 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"]
2 Sebastian Hoß <http://seb.xn--ho-hia.de/[@sebhoss]>
3 :github-org: sebhoss
4 :project-name: generic-types
5 :project-group: de.xn--ho-hia.utils.types
6 :coverity-project: 7620
7 :codacy-project: 9402c820df454d3a83c697f254aeb1b3
8 :toc:
9 :toc-placement: preamble
11 image:https://img.shields.io/badge/license-cc%20zero-000000.svg?style=flat-square["CC Zero", link="http://creativecommons.org/publicdomain/zero/1.0/"]
12 pass:[<span class="image"><a class="image" href="https://maven-badges.herokuapp.com/maven-central/de.xn--ho-hia.utils.types/generic-types"><img src="https://img.shields.io/maven-central/v/de.xn--ho-hia.utils.types/generic-types.svg?style=flat-square" alt="Maven Central"></a></span>]
13 pass:[<span class="image"><a class="image" href="https://www.javadoc.io/doc/de.xn--ho-hia.utils.types/generic-types"><img src="https://www.javadoc.io/badge/de.xn--ho-hia.utils.types/generic-types.svg?style=flat-square&color=blue" alt="Read JavaDocs"></a></span>]
14 image:https://reposs.herokuapp.com/?path={github-org}/{project-name}&style=flat-square["Repository size"]
15 image:https://www.openhub.net/p/{project-name}/widgets/project_thin_badge.gif["Open Hub statistics", link="https://www.openhub.net/p/{project-name}"]
17 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}"]
18 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}"]
19 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}"]
20 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}"]
21 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}"]
22 image:https://img.shields.io/maintenance/yes/2016.svg?style=flat-square["Is this thing still maintained?"]
23 image:https://img.shields.io/bountysource/team/metio/activity.svg?style=flat-square["Bounties on open tickets", link="https://www.bountysource.com/teams/metio"]
25 This https://www.java.com[Java] library provides a factory to create generic `java.lang.reflect.Type` variations, such as `Map<Number, Point>`.
27 === Features
29 * Factory methods to create generic types, including wildcards.
31 === Development Status
33 All currently required feature are implemented. This project is in maintenance mode.
36 == Usage
38 [source,java]
39 ----
40 // Map<Number, Point>
41 final Type type = GenericTypes.generic(Map.class, Number.class, Point.class);
43 // List<Number>
44 final Type type = GenericTypes.generic(List.class, Number.class);
45 ----
47 Super- and subtypes such as `List<? super Point>` or `List<? extends Number>` can be created in the following way:
49 [source,java]
50 ----
51 // List<? super Point>
52 final Type type = GenericTypes.generic(List.class, GenericTypes.supertype(Point.class));
54 // List<? extends Number>
55 final Type type = GenericTypes.generic(List.class, GenericTypes.subtype(Number.class));
56 ----
58 Use static imports to shorten the above calls to:
60 [source,java]
61 ----
62 // List<? super Point>
63 final Type type = generic(List.class, supertype(Point.class));
65 // List<? extends Number>
66 final Type type = generic(List.class, subtype(Number.class));
67 ----
69 and then go crazy with this:
71 [source,java]
72 ----
73 // List<Map<? extends Number, ? super Point>>
74 final Type type = generic(List.class, generic(Map.class, subtype(Number.class), supertype(Point.class)));
75 ----
77 === Integration
79 To use this project just declare the following dependency inside your POM:
81 [source,xml,subs="attributes,verbatim"]
82 ----
83 <dependencies>
84   <dependency>
85     <groupId>{project-group}</groupId>
86     <artifactId>{project-name}</artifactId>
87     <version>${version.generic-types}</version>
88   </dependency>
89 </dependencies>
90 ----
92 Replace `${version.generic-types}` with the pass:[<a href="http://search.maven.org/#search%7Cga%7C1%7Cg%3Ade.xn--ho-hia.utils.types%20a%3Ageneric-types">latest release</a>]. This project follows the link:http://semver.org/[semantic versioning guidelines].
95 === Compatibility
97 This project is compatible with the following Java versions:
99 .Java compatibility
100 |===
101 | | 1.X.Y | 2.X.Y
103 | Java 8
104 | ✓
105 | ✓
106 |===
108 == License
110 To the extent possible under law, the author(s) have dedicated all copyright
111 and related and neighboring rights to this software to the public domain
112 worldwide. This software is distributed without any warranty.
114 You should have received a copy of the CC0 Public Domain Dedication along
115 with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.
117 == Mirrors
119 * https://github.com/sebhoss/{project-name}
120 * https://bitbucket.org/sebhoss/{project-name}
121 * https://gitlab.com/sebastian.hoss/{project-name}
122 * http://v2.pikacode.com/sebhoss/{project-name}.java
123 * http://repo.or.cz/{project-name}.git