Skip to content

Commit 10be0b0

Browse files
committed
made changes according to 2nd batch of comments
1 parent 5383eb9 commit 10be0b0

File tree

12 files changed

+33
-21
lines changed

12 files changed

+33
-21
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ Presentation Tier patterns are the top-most level of the application, this is co
437437
**Applicability:** Use the Callback pattern when
438438
* When some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
439439

440-
<<<<<<< HEAD
440+
441441
## <a name="intercepting-filter">Intercepting Filter</a> [&#8593;](#list-of-design-patterns)
442442
**Intent:** Provide pluggable filters to conduct necessary pre-processing and post-processing to requests from a client to a target
443443

@@ -469,7 +469,7 @@ Presentation Tier patterns are the top-most level of the application, this is co
469469

470470
**Real world examples:**
471471
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
472-
>>>>>>> origin/master
472+
473473

474474
# Frequently asked questions
475475

@@ -515,14 +515,14 @@ The difference is the intent of the patterns. While Proxy controls access to the
515515
* [Let’s Modify the Objects-First Approach into Design-Patterns-First](http://edu.pecinovsky.cz/papers/2006_ITiCSE_Design_Patterns_First.pdf)
516516
* [Pattern Languages of Program Design](http://www.amazon.com/Pattern-Languages-Program-Design-Coplien/dp/0201607344/ref=sr_1_1)
517517
* [Martin Fowler - Event Aggregator](http://martinfowler.com/eaaDev/EventAggregator.html)
518-
<<<<<<< HEAD
518+
519519
* [TutorialsPoint - Intercepting Filter](http://www.tutorialspoint.com/design_pattern/intercepting_filter_pattern.htm)
520520
* [Presentation Tier Pattern](http://www.javagyan.com/tutorials/corej2eepatterns/presentation-tier-patterns)
521521
=======
522522
* [Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions](http://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467/ref=sr_1_1)
523523

524524

525-
>>>>>>> origin/master
525+
526526

527527
# License
528528

intercepting-filter/src/main/AddressFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/**
33
* Concrete implementation of filter
4-
*
4+
* This filter is responsible for checking/filtering the input in the address field, returns null if field is empty
55
* @author joshzambales
66
*
77
*/

intercepting-filter/src/main/Client.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
*
1313
*/
1414
public class Client extends JFrame{
15-
FilterManager filterManager;
16-
JLabel jl;
17-
JTextField[] jtFields;
18-
JTextArea[] jtAreas;
19-
JButton clearButton, processButton;
15+
private FilterManager filterManager;
16+
private JLabel jl;
17+
private JTextField[] jtFields;
18+
private JTextArea[] jtAreas;
19+
private JButton clearButton, processButton;
2020
public Client(){
2121
super("Client System");
2222
setDefaultCloseOperation(EXIT_ON_CLOSE);
@@ -69,7 +69,9 @@ public void actionPerformed(ActionEvent e){
6969
processButton.addActionListener(new ActionListener(){
7070
@Override
7171
public void actionPerformed(ActionEvent e){
72-
jl.setText(sendRequest(jtFields[0].getText()+"&"+jtFields[1].getText()+"&"+jtAreas[0].getText()+"&"+jtFields[2].getText()+"&"+jtAreas[1].getText()));
72+
String request = String.format("%s&%s&%s&%s&%s",jtFields[0].getText(),jtFields[1].getText(),jtAreas[0].getText(),jtFields[2].getText(),jtAreas[1].getText());
73+
74+
jl.setText(sendRequest(request));
7375
}
7476
});
7577

intercepting-filter/src/main/ContactFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Concrete implementation of filter
3-
*
3+
* This filter checks for the contact field in which it checks if the input consist of numbers and it also checks if the input follows the length constraint (11 digits)
44
* @author joshzambales
55
*
66
*/

intercepting-filter/src/main/DepositFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Concrete implementation of filter
3-
*
3+
*
4+
* This checks for the deposit code, returns null when deposit field is empty
45
* @author joshzambales
56
*
67
*/

intercepting-filter/src/main/Filter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/**
2-
* Filter interface
2+
* Filter interface
3+
* Filters perform certain tasks prior or after execution of request by request handler.
4+
* In this case, before the request is handled by the target, the request undergoes through each Filter
35
* @author joshzambales
46
*
57
*/

intercepting-filter/src/main/FilterChain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
public class FilterChain{
88
private ArrayList<Filter> filters = new ArrayList<Filter>();
9-
private Target target;
9+
private final Target target;
1010

1111
public FilterChain(Target target){
1212
this.target = target;

intercepting-filter/src/main/FilterManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*/
1111
public class FilterManager{
12-
FilterChain filterChain;
12+
private FilterChain filterChain;
1313

1414
public FilterManager(Target target){
1515
filterChain = new FilterChain(target);

intercepting-filter/src/main/NameFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
/**
3+
* Concrete implementation of filter
4+
* This filter checks if the input in the Name field is valid. (alphanumeric)
5+
* @author joshzambales
6+
*
7+
*/
18
public class NameFilter implements Filter{
29
public String execute(String[] request){
310
if(request[0].equals("") || request[0].matches(".*[^\\w|\\s]+.*")){

intercepting-filter/src/main/OrderFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Concrete implementation of filter
3+
* This checks for the order field, returns null when order field is empty
34
*
45
* @author joshzambales
56
*

0 commit comments

Comments
 (0)