private static void validateManyToManyAnnotation(final Method method) { final ManyToMany manyToMany = method.getAnnotation(ManyToMany.class); if (manyToMany != null) { final Class<? extends RawEntity<?>> throughType = manyToMany.value(); final String reverse = manyToMany.reverse(); if (reverse.length() != 0) { try { throughType.getMethod(reverse); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid reverse element value. It must be the name of the corresponding getter method on the joining entity.", exception); } } if (manyToMany.through().length() != 0) { try { throughType.getMethod(manyToMany.through()); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid through element value. It must be the name of the getter method on the joining entity that refers to the remote entities.", exception); } } } }
private static void validateManyToManyAnnotation(final Method method) { final ManyToMany manyToMany = method.getAnnotation(ManyToMany.class); if (manyToMany != null) { final Class<? extends RawEntity<?>> throughType = manyToMany.value(); final String reverse = manyToMany.reverse(); if (reverse.length() != 0) { try { throughType.getMethod(reverse); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid reverse element value. It must be the name of the corresponding getter method on the joining entity.", exception); } } if (manyToMany.through().length() != 0) { try { throughType.getMethod(manyToMany.through()); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid through element value. It must be the name of the getter method on the joining entity that refers to the remote entities.", exception); } } } }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchManyToMany(final RawEntity<K> proxy, final Method method, final ManyToMany manyToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> throughType = manyToManyAnnotation.value(); final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, null, Common.getMappingFields(getFieldNameConverter(), throughType, type), throughType, (Class<? extends RawEntity>) type, Common.where(manyToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, entityInfo.getEntityType()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, type)); }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchManyToMany(final RawEntity<K> proxy, final Method method, final ManyToMany manyToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> throughType = manyToManyAnnotation.value(); final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, null, Common.getMappingFields(getFieldNameConverter(), throughType, type), throughType, (Class<? extends RawEntity>) type, Common.where(manyToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, entityInfo.getEntityType()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, type)); }
private RawEntity[] fetchManyToMany(final Method method, final ManyToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final Class throughType = annotation.value(); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class);
private RawEntity[] fetchManyToMany(final Method method, final ManyToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final Class throughType = annotation.value(); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class);