use of aQute.lib.converter.TypeReference in project bnd by bndtools.
the class JSONTest method testGenericsVars.
public void testGenericsVars() {
ParameterizedType type = (ParameterizedType) new TypeReference<Base<String>>() {
}.getType();
System.out.println(type);
ParameterizedType list = (ParameterizedType) Base.class.getGenericInterfaces()[0];
System.out.println(list);
TypeVariable<?> tv = (TypeVariable<?>) list.getActualTypeArguments()[0];
System.out.println(tv.getGenericDeclaration().getTypeParameters()[0] == tv);
System.out.println(type.getRawType());
}
use of aQute.lib.converter.TypeReference in project bnd by bndtools.
the class Index method init.
private void init() throws Exception {
if (repo == null) {
cache = new TreeMap<String, TreeMap<Version, Library.RevisionRef>>();
if (indexFile.isFile() && indexFile.length() > 100) {
try (Decoder dec = codec.dec()) {
repo = dec.from(indexFile).get(new TypeReference<Repo>() {
});
for (Library.RevisionRef r : repo.revisionRefs) {
TreeMap<Version, Library.RevisionRef> map = cache.get(r.bsn);
if (map == null) {
map = new TreeMap<Version, Library.RevisionRef>(Collections.reverseOrder());
cache.put(r.bsn, map);
}
Version v = toVersion(r.baseline, r.qualifier);
map.put(v, r);
}
}
} else {
repo = new Repo();
}
}
}
Aggregations