polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject EntityTypeNotFoundException better reporting
Date Wed, 24 Jun 2015 08:03:30 GMT
Gang,
for a very long time, it has bothered me that the
EntityTypeNotFoundException is too "barren", one get to know the type is
not visible, but often it is hard to see "why".

So, I have added that it reports "from" which module, and what entity types
can be seen from there.

Since this exception is thrown from Entity Store implementations, I needed
to modify the SPI, so that it is possible to query what the visible types
are, and instead of putting that into Qi4jSPI, I decided to create an
injectable ModuleSpi type for this and other SPI specific usage.

public interface ModuleSpi extends Module
{
    EntityStore entityStore();
    IdentityGenerator identityGenerator();
    ValueSerialization valueSerialization();
    Iterable<ModelModule<EntityDescriptor>> findVisibleEntityTypes();
    Iterable<ModelModule<ValueDescriptor>> findVisibleValueTypes();
    Iterable<ModelModule<TransientDescriptor>> findVisibleTransientTypes();
    Iterable<ModelModule<ObjectDescriptor>> findVisibleObjectTypes();
    Iterable<ModelModule<ServiceDescriptor>> findVisibleServiceTypes();
}

It also required the ModelModule class to be promoted from 'runtime' to
'spi'. That is simply a container holding the Type and the Module pair.

I will commit later today to 'develop', unless there are objections...

Cheers
-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message