Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Replace Collection.class.isInstance with instanceof for type checking. Remove unnecessary type check for ConfigurableListableBeanFactory in postProcessBeanFactory method.

Closes #3580
  • Loading branch information
Seol-JY authored and mp911de committed Aug 14, 2024
1 parent 303c2db commit fcdebde
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConf

registerIfNotAlreadyRegistered(() -> {

Object value = AnnotationRepositoryConfigurationSource.class.isInstance(config) //
Object value = config instanceof AnnotationRepositoryConfigurationSource //
? config.getRequiredAttribute(ESCAPE_CHARACTER_PROPERTY, Character.class) //
: config.getAttribute(ESCAPE_CHARACTER_PROPERTY).orElse("\\");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ public int getOrder() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

if (!ConfigurableListableBeanFactory.class.isInstance(beanFactory)) {
return;
}

ConfigurableListableBeanFactory factory = beanFactory;

for (EntityManagerFactoryBeanDefinition definition : getEntityManagerFactoryBeanDefinitions(factory)) {
for (EntityManagerFactoryBeanDefinition definition : getEntityManagerFactoryBeanDefinitions(beanFactory)) {

BeanFactory definitionFactory = definition.getBeanFactory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void deleteAllByIdInBatch(Iterable<ID> ids) {
* Some JPA providers require {@code ids} to be a {@link Collection} so we must convert if it's not already.
*/

if (Collection.class.isInstance(ids)) {
if (ids instanceof Collection) {
query.setParameter("ids", ids);
} else {
Collection<ID> idsCollection = StreamSupport.stream(ids.spliterator(), false)
Expand Down

0 comments on commit fcdebde

Please sign in to comment.