use of org.whole.lang.exceptions.WholeIllegalArgumentException in project whole by wholeplatform.
the class ReusablesDynamicCompilerVisitor method visit.
@Override
public void visit(PersistenceId entity) {
String persistenceKitId = entity.getValue();
setResultIterator(IteratorFactory.singleValuedRunnableIterator((IEntity selfEntity, IBindingManager bm, IEntity... arguments) -> {
if (!ReflectionFactory.hasPersistenceKit(persistenceKitId))
throw new WholeIllegalArgumentException("The Persistence is not deployed: " + persistenceKitId).withSourceEntity(entity).withBindings(bm);
bm.setResult(BindingManagerFactory.instance.createValue(ReflectionFactory.getPersistenceKit(persistenceKitId)));
}).withSourceEntity(entity));
}
use of org.whole.lang.exceptions.WholeIllegalArgumentException in project whole by wholeplatform.
the class ReusablesDynamicCompilerVisitor method visit.
@Override
public void visit(URL entity) {
entity.getPersistence().accept(this);
IEntityIterator<?> persistenceIterator = getResultIterator();
entity.getContent().accept(this);
IEntityIterator<?> contentIterator = getResultIterator();
setResultIterator(IteratorFactory.composeIterator(IteratorFactory.singleValuedRunnableIterator(new ResourcePersistenceRunnable() {
protected IPersistenceProvider getPersistenceProvider(String path, IBindingManager bm) {
try {
return new URLPersistenceProvider(new java.net.URL(path), bm);
} catch (MalformedURLException e) {
throw new WholeIllegalArgumentException(e).withSourceEntity(entity).withBindings(bm);
}
}
}, new int[] { 0 }, persistenceIterator).withSourceEntity(entity), contentIterator));
}
Aggregations