final LogicalPath path = PhysicalTypeIdentifier.getPath(id);
final String entityMid = JpaActiveRecordMetadata.createIdentifier(
javaType, path);
// Get the entity metadata
final JpaActiveRecordMetadata jpaActiveRecordMetadata = (JpaActiveRecordMetadata) metadataService
.get(entityMid);
if (jpaActiveRecordMetadata == null) {
throw new IllegalArgumentException(
"Cannot provide finders because '"
+ typeName.getFullyQualifiedTypeName()
+ "' is not an 'active record' entity");
}
// Get the member details
final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) metadataService
.get(PhysicalTypeIdentifier.createIdentifier(javaType, path));
if (physicalTypeMetadata == null) {
throw new IllegalStateException(
"Could not determine physical type metadata for type "
+ javaType);
}
final ClassOrInterfaceTypeDetails cid = physicalTypeMetadata
.getMemberHoldingTypeDetails();
if (cid == null) {
throw new IllegalStateException(
"Could not determine class or interface type details for type "
+ javaType);
}
final MemberDetails memberDetails = memberDetailsScanner
.getMemberDetails(getClass().getName(), cid);
final List<FieldMetadata> idFields = persistenceMemberLocator
.getIdentifierFields(javaType);
final FieldMetadata versionField = persistenceMemberLocator
.getVersionField(javaType);
// Compute the finders (excluding the ID, version, and EM fields)
final Set<JavaSymbolName> exclusions = new HashSet<JavaSymbolName>();
exclusions.add(jpaActiveRecordMetadata.getEntityManagerField()
.getFieldName());
for (final FieldMetadata idField : idFields) {
exclusions.add(idField.getFieldName());
}
if (versionField != null) {
exclusions.add(versionField.getFieldName());
}
final SortedSet<String> result = new TreeSet<String>();
final List<JavaSymbolName> finders = dynamicFinderServices.getFinders(
memberDetails, jpaActiveRecordMetadata.getPlural(), depth,
exclusions);
for (final JavaSymbolName finder : finders) {
// Avoid displaying problematic finders
try {
final QueryHolder queryHolder = dynamicFinderServices
.getQueryHolder(memberDetails, finder,
jpaActiveRecordMetadata.getPlural(),
jpaActiveRecordMetadata.getEntityName());
final List<JavaSymbolName> parameterNames = queryHolder
.getParameterNames();
final List<JavaType> parameterTypes = queryHolder
.getParameterTypes();
final StringBuilder signature = new StringBuilder();