实现了责任链设计模式的 Java 类库 - Commons Chain

fmms 12年前
     <p>Commons Chain 是一个实现了责任链设计模式的 Java 类库。</p>    <p>示例代码:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">package org.apache.commons.chain.mailreader.commands;  import org.apache.commons.chain.Command; import org.apache.commons.chain.Context;  public class ProfileCheck implements Command {      public Profile newProfile(Context context) { return new Profile(); }      public boolean execute(Context context) throws Exception {         Object profile = context.get(Profile.PROFILE_KEY);         if (null == profile) {             profile = newProfile(context);             context.put(Profile.PROFILE_KEY, profile);         }         return false;     } }</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326937782952" target="_blank">http://www.open-open.com/lib/view/home/1326937782952</a></p>    <p></p>