Resolves checkstyle errors for patterns starting with letter r (#1072)

* Reduces checkstyle errors in reactor

* Reduces checkstyle errors in reader-writer-lock

* Reduces checkstyle errors in repository

* Reduces checkstyle errors in resource-acquisition-is-initialization

* Reduces checkstyle errors in retry
This commit is contained in:
Anurag Agarwal
2019-11-10 23:12:26 +05:30
committed by Ilkka Seppälä
parent 4dae1fae57
commit 9c8ad4485b
31 changed files with 345 additions and 377 deletions

View File

@ -25,7 +25,6 @@ package com.iluwatar.repository;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -38,8 +37,8 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* query construction code is concentrated. This becomes more important when there are a large
* number of domain classes or heavy querying. In these cases particularly, adding this layer helps
* minimize duplicate query logic.
* <p>
* In this example we utilize Spring Data to automatically generate a repository for us from the
*
* <p>In this example we utilize Spring Data to automatically generate a repository for us from the
* {@link Person} domain object. Using the {@link PersonRepository} we perform CRUD operations on
* the entity, moreover, the query by {@link org.springframework.data.jpa.domain.Specification} are
* also performed. Underneath we have configured in-memory H2 database for which schema is created
@ -50,10 +49,9 @@ public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point
*
* @param args
* command line args
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {
@ -107,7 +105,7 @@ public class App {
}
repository.deleteAll();
context.close();
}

View File

@ -27,9 +27,7 @@ import java.sql.SQLException;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.slf4j.Logger;
@ -42,9 +40,7 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
/**
* This is the same example as in {@link App} but with annotations based
* configuration for Spring.
*
* This is the same example as in {@link App} but with annotations based configuration for Spring.
*/
@EnableJpaRepositories
@SpringBootConfiguration
@ -53,8 +49,8 @@ public class AppConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(AppConfig.class);
/**
* Creation of H2 db
*
* Creation of H2 db.
*
* @return A new Instance of DataSource
*/
@Bean(destroyMethod = "close")
@ -68,11 +64,12 @@ public class AppConfig {
}
/**
* Factory to create a especific instance of Entity Manager
* Factory to create a especific instance of Entity Manager.
*/
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean();
LocalContainerEntityManagerFactoryBean entityManager =
new LocalContainerEntityManagerFactoryBean();
entityManager.setDataSource(dataSource());
entityManager.setPackagesToScan("com.iluwatar");
entityManager.setPersistenceProvider(new HibernatePersistenceProvider());
@ -82,7 +79,7 @@ public class AppConfig {
}
/**
* Properties for Jpa
* Properties for Jpa.
*/
private static Properties jpaProperties() {
Properties properties = new Properties();
@ -92,7 +89,7 @@ public class AppConfig {
}
/**
* Get transaction manager
* Get transaction manager.
*/
@Bean
public JpaTransactionManager transactionManager() throws SQLException {
@ -102,10 +99,9 @@ public class AppConfig {
}
/**
* Program entry point
*
* @param args
* command line args
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {

View File

@ -28,9 +28,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
*
* Person entity
*
* Person entity.
*/
@Entity
public class Person {
@ -47,7 +45,7 @@ public class Person {
}
/**
* Constructor
* Constructor.
*/
public Person(String name, String surname, int age) {
this.name = name;

View File

@ -28,9 +28,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
/**
*
* Person repository
*
* Person repository.
*/
@Repository
public interface PersonRepository

View File

@ -27,16 +27,15 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.data.jpa.domain.Specification;
/**
* Helper class, includes vary Specification as the abstraction of sql query criteria
* Helper class, includes vary Specification as the abstraction of sql query criteria.
*/
public class PersonSpecifications {
/**
* Specifications stating the Between (From - To) Age Specification
* Specifications stating the Between (From - To) Age Specification.
*/
public static class AgeBetweenSpec implements Specification<Person> {
@ -59,8 +58,7 @@ public class PersonSpecifications {
}
/**
* Name specification
*
* Name specification.
*/
public static class NameEqualSpec implements Specification<Person> {
@ -71,7 +69,7 @@ public class PersonSpecifications {
}
/**
* Get predicate
* Get predicate.
*/
public Predicate toPredicate(Root<Person> root, CriteriaQuery<?> query, CriteriaBuilder cb) {