IDEA inspection refactorings.
This commit is contained in:
@@ -5,7 +5,7 @@ import java.util.Map;
|
||||
|
||||
public class BankDaoStub implements BankDao {
|
||||
private long id = 0;
|
||||
private Map<Long, Account> accounts = new HashMap<Long, Account>();
|
||||
private final Map<Long, Account> accounts = new HashMap<Long, Account>();
|
||||
|
||||
public void createOrUpdateAccount(Account account) {
|
||||
if (account.getId() == -1) {
|
||||
@@ -17,12 +17,12 @@ public class BankDaoStub implements BankDao {
|
||||
}
|
||||
|
||||
public Account[] findAccounts() {
|
||||
Account[] a = accounts.values().toArray(new Account[] {});
|
||||
System.out.println("Returning " + a.length + " account(s):");
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
System.out.println(" > " + a[i]);
|
||||
Account[] accounts = this.accounts.values().toArray(new Account[] {});
|
||||
System.out.println("Returning " + accounts.length + " account(s):");
|
||||
for (Account account : accounts) {
|
||||
System.out.println(" > " + account);
|
||||
}
|
||||
return a;
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public Account readAccount(Long id) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
public class BankServiceImpl implements BankService {
|
||||
private BankDao bankDao;
|
||||
private final BankDao bankDao;
|
||||
|
||||
// Not used unless you declare a <protect-pointcut>
|
||||
@Pointcut("execution(* bigbank.BankServiceImpl.*(..))")
|
||||
|
||||
@@ -11,7 +11,7 @@ import bigbank.BankService;
|
||||
|
||||
public class ListAccounts implements Controller {
|
||||
|
||||
private BankService bankService;
|
||||
private final BankService bankService;
|
||||
|
||||
public ListAccounts(BankService bankService) {
|
||||
Assert.notNull(bankService);
|
||||
|
||||
@@ -13,7 +13,7 @@ import bigbank.BankService;
|
||||
|
||||
public class PostAccounts implements Controller {
|
||||
|
||||
private BankService bankService;
|
||||
private final BankService bankService;
|
||||
|
||||
public PostAccounts(BankService bankService) {
|
||||
Assert.notNull(bankService);
|
||||
|
||||
Reference in New Issue
Block a user