标签云

微信群

扫码加入我们

WeChat QR Code

I am learning GoF Java Design Patterns and I want to see some real life examples of them. What are some good examples of these Design Patterns in Java's core libraries?


impressive.. :) +1. javax.lang.model.element defines visitors ;) I'm not quite sure whether doXXX and doFilter are "strategies".

2019年10月20日45分47秒

The mentioned builders e.g. StrinbgBuilder are all not an example for the Builder-Pattern. It is a very common mistake however to consider them as builders (so you are not really to blame ^_^)

2019年10月20日45分47秒

BalusC: Object.toString() can hardly be considered to be a factory method; the class relationship is right but the intention is wrong. It's hard to draw the line of course, but any method creating and returning another object can't be called a factory method. Maybe you can say that purpose of toString isn't to create a string but the return info about the receiver, therefore it is not a factory method.

2019年10月21日45分47秒

BalusC, I have a question to ask you. Did you read the WHOLE source code of Java and JSF?

2019年10月21日45分47秒

Tapas: I did not read everything, only parts which I needed to, or were just curious as to how "they" did it.

2019年10月20日45分47秒

Thanks for the tip on MouseAdapter. I found this exaplanation: stackoverflow.com/questions/9244185/…

2019年10月20日45分47秒

Concerning Flyweight pattern: it could be different Layout Managers from java.awt and java.swing packages. Indeed, they share almost identical intrinsic attributes and extrinsic attributes are different UI components that they lay out in UI form.

2019年10月20日45分47秒

NawaMan You said 5. Comand TextComponent's Undo/Redo. I think it is memento not command. Or most probably both.

2019年10月20日45分47秒