private List<MethodMetadata> locateAccessors( final JavaType javaType, final MemberDetails memberDetails, final String metadataIdentificationString) { final SortedSet<MethodMetadata> locatedAccessors = new TreeSet<MethodMetadata>( new Comparator<MethodMetadata>() { public int compare(final MethodMetadata l, final MethodMetadata r) { return l.getMethodName().compareTo(r.getMethodName()); } }); for (MethodMetadata method : memberDetails.getMethods()) { // Exclude cyclic self-references (ROO-325) if (BeanInfoUtils.isAccessorMethod(method) && !method.getReturnType().equals(javaType) && !method.getMethodName().getSymbolName().equals("getDisplayString")) { locatedAccessors.add(method); // Track any changes to that method (eg it goes away) metadataDependencyRegistry.registerDependency( method.getDeclaredByMetadataId(), metadataIdentificationString); } } return new ArrayList<MethodMetadata>(locatedAccessors); }
public Set<JavaType> getPersistentFieldTypes( final JavaType thisType, final PersistenceMemberLocator persistenceMemberLocator) { final MethodMetadata identifierAccessor = persistenceMemberLocator.getIdentifierAccessor(thisType); final MethodMetadata versionAccessor = persistenceMemberLocator.getVersionAccessor(thisType); final Set<JavaType> fieldTypes = new LinkedHashSet<JavaType>(); for (final MethodMetadata method : getMethods()) { // Not interested in non-accessor methods or persistence identifiers // and version fields if (!BeanInfoUtils.isAccessorMethod(method) || method.hasSameName(identifierAccessor, versionAccessor)) { continue; } // Not interested in fields that are JPA transient fields or // immutable fields final FieldMetadata field = BeanInfoUtils.getFieldForJavaBeanMethod(this, method); if (field == null || field.getCustomData().keySet().contains(CustomDataKeys.TRANSIENT_FIELD) || !BeanInfoUtils.hasAccessorAndMutator(field, this)) { continue; } final JavaType returnType = method.getReturnType(); if (returnType.isCommonCollectionType()) { for (final JavaType genericType : returnType.getParameters()) { fieldTypes.add(genericType); } } else { if (!field.getCustomData().keySet().contains(EMBEDDED_FIELD)) { fieldTypes.add(returnType); } } } return fieldTypes; }