@@ -60,7 +60,7 @@ compile 'ru.vyarus:generics-resolver:1.0.0'
6060
6161### Usage
6262
63- First class hierarchy needs to be parsed to properly resolve all generics:
63+ Class hierarchy needs to be parsed to properly resolve all generics:
6464
6565``` java
6666GenericsContext context = GenericsResolver . resolve(Root . class)
@@ -77,8 +77,8 @@ In some rare cases you may need to exclude some interfaces from resolution (e.g.
7777GenericsResolver . resolve(Root . class, Callable . class, Runnable . class)
7878```
7979
80- When ignored classes specified resolved generics information is not cached(!) even if complete type resolution
81- was replaced before (descriptor always computed).
80+ When ignored classes specified, resolved generics information is not cached(!) even if complete type resolution
81+ was done before (descriptor always computed).
8282
8383#### Context
8484
@@ -92,9 +92,9 @@ To navigate on different class use
9292context. type(Base . class)
9393```
9494Which returns new instance of context. This method is not tied to actual class hierarchy so you can obtain context
95- of any class (available in root class hierarchy) from any context.
95+ of any class (available in root class hierarchy) from any context instance .
9696
97- Context operates on types (` Type ` ) not classes, because only types holds all generics information, including composite
97+ Context operates on types (` Type ` ), not classes, because only types holds all generics information, including composite
9898generics info (e.g. ` List<List<String>> ` ). Any type, obtained using reflection may be resolved through api to real class.
9999
100100All classes in root class hierarchy may be obtained like this:
@@ -153,13 +153,13 @@ context.resolveClass(doSomething.getGenericReturnType()) == List.class
153153context.resolveGenericOf(doSomething.getGenericReturnType()) == Integer.class
154154```
155155
156- Here you can see how you can resolve both class and generic class from single type.
156+ Here you can see how both main class and generic class resolved from single type instance .
157157
158158See api for all supported methods.
159159
160160#### To string
161161
162- Any type could be resolved as string (from example above) :
162+ Any type could be resolved as string:
163163
164164``` groovy
165165context.toStringType(doSomething.getGenericReturnType()) == "List<Integer>"
@@ -170,15 +170,13 @@ context.toStringType(doSomething.getGenericReturnType()) == "List<Integer>"
170170Few real life usages.
171171
172172[ guice-persist-orient] ( https://github.com/xvik/guice-persist-orient ) use it to introspect finder types hierarchies.
173- For one cases there are very important to know proper return types and without generics resolution everything was flat
174- (limited to one class). Another example is delegating method search: without proper generics resolution of method parameters
175- searching for compatible method would be much less effective (proper types reduce search scope). And the last example is
176- using generic name to substitute correct type in sql query, which allows to write completely generic queries.
177-
178- [ dropwizard-guicey] ( https://github.com/xvik/dropwizard-guicey ) use it for reporting: it's convenient to see usage
179- examples of jersey plugins. By knowing plugin interface it's able to resolve generics, to string it and print extension
180- usage example. Another aspect is factories registration: having only implementations of Factory<T > class, without solving
181- generic it's impossible to know factory type.
173+ Before generics resolution, finders were flat, because internal logic relies on method return types.
174+ Another example is searching for target method using arguments: argument generics resolution greatly reduce search scope.
175+ And the last example is using generic name to substitute correct type in sql query, which allows to write completely generic queries.
176+
177+ [ dropwizard-guicey] ( https://github.com/xvik/dropwizard-guicey ) use it for reporting of usage examples for registered jersey plugins
178+ (resolving plugin interface generics, convert them to strings and compose example report).
179+ Another aspect is factories registration: for proper jersey integration it needs to know types for registered factories (` Factory<T> ` class).
182180
183181-
184182[ ![ Slush java lib generator] ( http://img.shields.io/badge/Powered%20by-Slush%20java%20lib%20generator-orange.svg?style=flat-square )] ( https://github.com/xvik/slush-lib-java )
0 commit comments