use of com.liferay.apio.architect.representor.Representable in project com-liferay-apio-architect by liferay.
the class RepresentableManagerImpl method emit.
@Override
protected void emit(ServiceReference<Representable> serviceReference, Emitter<Class<Identifier>> emitter) {
Representable representable = bundleContext.getService(serviceReference);
Class<Identifier> genericClass = getGenericClassFromPropertyOrElse(serviceReference, KEY_PRINCIPAL_TYPE_ARGUMENT, () -> getTypeParamOrFail(representable, Representable.class, 2));
emitter.emit(genericClass);
}
use of com.liferay.apio.architect.representor.Representable in project com-liferay-apio-architect by liferay.
the class RepresentableManagerImpl method _computeRepresentables.
private void _computeRepresentables() {
Map<String, List<RelatedCollection<?>>> relatedCollections = new HashMap<>();
Stream<Class<Identifier>> keyStream = getKeyStream();
keyStream.forEach(clazz -> {
Representable representable = serviceTrackerMap.getService(clazz);
String name = representable.getName();
Optional<Map<String, String>> optional = INSTANCE.getNamesOptional();
Optional<String> classNameOptional = optional.map(Map::entrySet).map(Collection::stream).orElseGet(Stream::empty).filter(entry -> Objects.equals(entry.getValue(), name)).map(Entry::getKey).findFirst();
if (classNameOptional.isPresent()) {
if (_apioLogger != null) {
_apioLogger.warning(_getDuplicateErrorMessage(clazz, name, classNameOptional.get()));
}
return;
}
INSTANCE.putName(clazz.getName(), name);
INSTANCE.putIdentifierClass(name, clazz);
INSTANCE.putRepresentor(name, _getRepresentor(unsafeCast(representable), unsafeCast(clazz), relatedCollections));
});
}
Aggregations