/** * Returns the {@link JavaType} for the given entity's "data on demand" * class. * * @param entity * the entity for which to get the DoD type * @return a non-<code>null</code> type (which may or may not exist yet) */ private JavaType getDataOnDemandType(final JavaType entity, final PhysicalTypeMetadata governorPhysicalTypeMetadata) { for (final ClassOrInterfaceTypeDetails dodType : getTypeLocationService() .findClassesOrInterfaceDetailsWithAnnotation(ROO_DATA_ON_DEMAND)) { final AnnotationMetadata dodAnnotation = MemberFindingUtils.getFirstAnnotation(dodType, ROO_DATA_ON_DEMAND); if (dodAnnotation != null && dodAnnotation.getAttribute("entity").getValue().equals(entity) && governorPhysicalTypeMetadata.getType().getModule() .equals(dodType.getType().getModule())) { return dodType.getName(); } } return null; }