装饰模式
2、Decorator (recognizeable by creational methods taking an instance of same abstract/interface type which adds additional behaviour)
--装饰模式(为一个对象动态的加上一系列的动作,而不需要因为这些动作的不同而产生大量的继承类)
例如:
public BufferedInputStream(InputStream in, int size) { super(in); if (size <= 0) { throw new IllegalArgumentException("Buffer size <= 0"); } buf = new byte[size]; }

浙公网安备 33010602011771号