private RepositoryComposition getRepositoryComposition(RepositoryMetadata metadata, RepositoryComposition.RepositoryFragments fragments) { Assert.notNull(metadata, "RepositoryMetadata must not be null!"); Assert.notNull(fragments, "RepositoryFragments must not be null!"); RepositoryComposition composition = getRepositoryComposition(metadata); RepositoryComposition.RepositoryFragments repositoryAspects = getRepositoryFragments(metadata); return composition.append(fragments).append(repositoryAspects); }
/** * Creates {@link RepositoryComposition} based on {@link RepositoryMetadata} for repository-specific method handling. * * @param metadata * @return */ private RepositoryComposition getRepositoryComposition(RepositoryMetadata metadata) { RepositoryComposition composition = RepositoryComposition.empty(); if (metadata.isReactiveRepository()) { return composition.withMethodLookup(MethodLookups.forReactiveTypes(metadata)) .withArgumentConverter(REACTIVE_ARGS_CONVERTER); } return composition.withMethodLookup(MethodLookups.forRepositoryTypes(metadata)); }
@Override public boolean isCustomMethod(Method method) { return composition.findMethod(method).isPresent(); }
/** * Creates a new {@link DefaultRepositoryMetadata} for the given repository interface and repository base class. * * @param metadata must not be {@literal null}. * @param repositoryBaseClass must not be {@literal null}. * @param composition must not be {@literal null}. */ public DefaultRepositoryInformation(RepositoryMetadata metadata, Class<?> repositoryBaseClass, RepositoryComposition composition) { Assert.notNull(metadata, "Repository metadata must not be null!"); Assert.notNull(repositoryBaseClass, "Repository base class must not be null!"); Assert.notNull(composition, "Repository composition must not be null!"); this.metadata = metadata; this.repositoryBaseClass = repositoryBaseClass; this.composition = composition; this.baseComposition = RepositoryComposition.of(RepositoryFragment.structural(repositoryBaseClass)) // .withArgumentConverter(composition.getArgumentConverter()) // .withMethodLookup(composition.getMethodLookup()); }
/** * Validates the given repository interface as well as the given custom implementation. * * @param repositoryInformation * @param composition */ private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) { if (repositoryInformation.hasCustomMethod()) { if (composition.isEmpty()) { throw new IllegalArgumentException( String.format("You have custom methods in %s but not provided a custom implementation!", repositoryInformation.getRepositoryInterface())); } composition.validateImplementation(); } validate(repositoryInformation); }
/** * Creates a new {@link RepositoryFactorySupport.RepositoryInformationCacheKey} for the given {@link RepositoryMetadata} and composition. * * @param metadata must not be {@literal null}. * @param composition must not be {@literal null}. */ public RepositoryInformationCacheKey(RepositoryMetadata metadata, RepositoryComposition composition) { this.repositoryInterfaceName = metadata.getRepositoryInterface().getName(); this.compositionHash = composition.hashCode(); }
/** * Create a {@link RepositoryComposition} from {@link RepositoryFragment fragments} with * {@link MethodLookups#direct()) method lookup. * * @param fragments must not be {@literal null}. * @return the {@link RepositoryComposition} from {@link RepositoryFragment fragments}. */ public static RepositoryComposition of(RepositoryFragment<?>... fragments) { return of(Arrays.asList(fragments)); }
/** * Creates a new {@link DefaultRepositoryMetadata} for the given repository interface and repository base class. * * @param metadata must not be {@literal null}. * @param repositoryBaseClass must not be {@literal null}. * @param composition must not be {@literal null}. */ public DefaultRepositoryInformation(RepositoryMetadata metadata, Class<?> repositoryBaseClass, RepositoryComposition composition) { Assert.notNull(metadata, "Repository metadata must not be null!"); Assert.notNull(repositoryBaseClass, "Repository base class must not be null!"); Assert.notNull(composition, "Repository composition must not be null!"); this.metadata = metadata; this.repositoryBaseClass = repositoryBaseClass; this.composition = composition; this.baseComposition = RepositoryComposition.of(RepositoryFragment.structural(repositoryBaseClass)) // .withArgumentConverter(composition.getArgumentConverter()) // .withMethodLookup(composition.getMethodLookup()); }
/** * Validates the given repository interface as well as the given custom implementation. * * @param repositoryInformation * @param composition */ private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) { if (repositoryInformation.hasCustomMethod()) { if (composition.isEmpty()) { throw new IllegalArgumentException( String.format("You have custom methods in %s but not provided a custom implementation!", repositoryInformation.getRepositoryInterface())); } composition.validateImplementation(); } validate(repositoryInformation); }
/** * Creates a new {@link RepositoryFactorySupport.RepositoryInformationCacheKey} for the given {@link RepositoryMetadata} and composition. * * @param metadata must not be {@literal null}. * @param composition must not be {@literal null}. */ public RepositoryInformationCacheKey(RepositoryMetadata metadata, RepositoryComposition composition) { this.repositoryInterfaceName = metadata.getRepositoryInterface().getName(); this.compositionHash = composition.hashCode(); }
/** * Creates a new {@link DefaultRepositoryMetadata} for the given repository interface and repository base class. * * @param metadata must not be {@literal null}. * @param repositoryBaseClass must not be {@literal null}. * @param composition must not be {@literal null}. */ public DefaultRepositoryInformation(RepositoryMetadata metadata, Class<?> repositoryBaseClass, RepositoryComposition composition) { Assert.notNull(metadata, "Repository metadata must not be null!"); Assert.notNull(repositoryBaseClass, "Repository base class must not be null!"); Assert.notNull(composition, "Repository composition must not be null!"); this.metadata = metadata; this.repositoryBaseClass = repositoryBaseClass; this.composition = composition; this.baseComposition = RepositoryComposition.of(RepositoryFragment.structural(repositoryBaseClass)) // .withArgumentConverter(composition.getArgumentConverter()) // .withMethodLookup(composition.getMethodLookup()); }
/** * Creates {@link RepositoryComposition} based on {@link RepositoryMetadata} for repository-specific method handling. * * @param metadata * @return */ private RepositoryComposition getRepositoryComposition(RepositoryMetadata metadata) { RepositoryComposition composition = RepositoryComposition.empty(); if (metadata.isReactiveRepository()) { return composition.withMethodLookup(MethodLookups.forReactiveTypes(metadata)) .withArgumentConverter(REACTIVE_ARGS_CONVERTER); } return composition.withMethodLookup(MethodLookups.forRepositoryTypes(metadata)); }
/** * Validates the given repository interface as well as the given custom implementation. * * @param repositoryInformation * @param composition */ private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) { if (repositoryInformation.hasCustomMethod()) { if (composition.isEmpty()) { throw new IllegalArgumentException( String.format("You have custom methods in %s but not provided a custom implementation!", repositoryInformation.getRepositoryInterface())); } composition.validateImplementation(); } validate(repositoryInformation); }
@Override public boolean isCustomMethod(Method method) { return composition.findMethod(method).isPresent(); }
private RepositoryComposition getRepositoryComposition(RepositoryMetadata metadata, RepositoryComposition.RepositoryFragments fragments) { Assert.notNull(metadata, "RepositoryMetadata must not be null!"); Assert.notNull(fragments, "RepositoryFragments must not be null!"); RepositoryComposition composition = getRepositoryComposition(metadata); RepositoryComposition.RepositoryFragments repositoryAspects = getRepositoryFragments(metadata); return composition.append(fragments).append(repositoryAspects); }
/** * Creates a new {@link RepositoryFactorySupport.RepositoryInformationCacheKey} for the given {@link RepositoryMetadata} and composition. * * @param metadata must not be {@literal null}. * @param composition must not be {@literal null}. */ public RepositoryInformationCacheKey(RepositoryMetadata metadata, RepositoryComposition composition) { this.repositoryInterfaceName = metadata.getRepositoryInterface().getName(); this.compositionHash = composition.hashCode(); }
/** * Creates a new {@link DefaultRepositoryMetadata} for the given repository interface and repository base class. * * @param metadata must not be {@literal null}. * @param repositoryBaseClass must not be {@literal null}. * @param composition must not be {@literal null}. */ public DefaultRepositoryInformation(RepositoryMetadata metadata, Class<?> repositoryBaseClass, RepositoryComposition composition) { Assert.notNull(metadata, "Repository metadata must not be null!"); Assert.notNull(repositoryBaseClass, "Repository base class must not be null!"); Assert.notNull(composition, "Repository composition must not be null!"); this.metadata = metadata; this.repositoryBaseClass = repositoryBaseClass; this.composition = composition; this.baseComposition = RepositoryComposition.of(RepositoryFragment.structural(repositoryBaseClass)) // .withArgumentConverter(composition.getArgumentConverter()) // .withMethodLookup(composition.getMethodLookup()); }
/** * Creates {@link RepositoryComposition} based on {@link RepositoryMetadata} for repository-specific method handling. * * @param metadata * @return */ private RepositoryComposition getRepositoryComposition(RepositoryMetadata metadata) { RepositoryComposition composition = RepositoryComposition.empty(); if (metadata.isReactiveRepository()) { return composition.withMethodLookup(MethodLookups.forReactiveTypes(metadata)) .withArgumentConverter(REACTIVE_ARGS_CONVERTER); } return composition.withMethodLookup(MethodLookups.forRepositoryTypes(metadata)); }
/** * Validates the given repository interface as well as the given custom implementation. * * @param repositoryInformation * @param composition */ private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) { if (repositoryInformation.hasCustomMethod()) { if (composition.isEmpty()) { throw new IllegalArgumentException( String.format("You have custom methods in %s but not provided a custom implementation!", repositoryInformation.getRepositoryInterface())); } composition.validateImplementation(); } validate(repositoryInformation); }
@Override public boolean isCustomMethod(Method method) { return composition.findMethod(method).isPresent(); }