Skip to content

Commit 754cfcf

Browse files
feat:created a file and implementef code for AuditLog
1 parent dd011d8 commit 754cfcf

File tree

1 file changed

+45
-0
lines changed
  • lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.codedifferently.lesson17.bank;
2+
3+
import java.util.ArrayList;
4+
5+
public class AuditLog {
6+
private ArrayList<String> log;
7+
8+
/**
9+
* Constructor that creates a new AuditLog
10+
*
11+
*/
12+
public AuditLog(){
13+
this.log = new ArrayList<>();
14+
}
15+
16+
17+
/**
18+
* This adds audit entry to the log
19+
*
20+
* @param audit The audit entry to add to the log
21+
*/
22+
public void addToList(String audit){
23+
log.add(audit);
24+
}
25+
26+
/**
27+
* Gets a copy of all audit log entries
28+
*
29+
* @return A list of all audit log entries
30+
*/
31+
public ArrayList<String> getLogEntries(){
32+
return new ArrayList<>(log);
33+
}
34+
35+
/**
36+
* Gets the number of entries in the audit log
37+
*
38+
* @return The number of audit log entries
39+
*/
40+
public int getLogSize(){
41+
return log.size();
42+
}
43+
44+
45+
}

0 commit comments

Comments
 (0)