\CodePro Analytix Evaluation\src\com\instantiations\example\customer\Customer.java
Violations: 0 high, 17 medium, 1 low
 
Violations
Missing file comment Private field should be final: name Define the initial capacity of ArrayList instances
Import out of order: java.util Missing Javadoc comment for field Missing Javadoc comment for method "Customer"
Missing @version tag for type Customer Private field should be final: zip Missing Javadoc comment for method "getName"
toString() is missing Missing Javadoc comment for field Missing Javadoc comment for method "getZip"
Missing default constructor Variable should be declared as List Missing Javadoc comment for method "addAccount"
Missing Javadoc comment for field Private field should be final: accounts Missing Javadoc comment for method "getAccounts"
 
Source
1 package com.instantiations.example.customer;
2
3 import com.instantiations.example.account.*;
4 import java.util.*;
5
6 /**
7  * The class <code>Customer</code> exists for two purposes. The first is to
8  * define an object that can be created in a factory class. The second is to
9  * create a cyclic dependency between the <code>customer</code> and
10  * <code>account</code> projects.
11  * @author Brad Billings
12  */
13 public class Customer
14 {
15    private String name;
16
17    private String zip;
18
19    private ArrayList accounts = new ArrayList();
20
21    public Customer(String name, String zip)
22    {
23       this.name = name;
24       this.zip = zip;
25    }
26
27    public String getName()
28    {
29       return name;
30    }
31
32    public String getZip()
33    {
34       return zip;
35    }
36
37    public void addAccount(Account account)
38    {
39       accounts.add(account);
40    }
41
42    public Account[] getAccounts()
43    {
44       return (Account[]) accounts.toArray(new Account[accounts.size()]);
45    }
46 }
Powered by CodePro AnalytiX