Java Design Pattern Flow pattern

Source: Internet
Author: User

http://www.verejava.com/?id=16999114235569

Package Com.flow.theory;public class test{public static void Main (string[] args) {context ctx=new context ()        ;        Ctx.setflow (New Applyflow ());                Ctx.process ();        Ctx.setflow (New Verfiyflow ());                Ctx.process ();        Ctx.setflow (New Approveflow ());    Ctx.process (); }}package Com.flow.theory;public Interface flow{public void action (); Package Com.flow.theory;public class Verfiyflow implements flow{@Override public void Action () {SYSTEM.O    UT.PRINTLN ("Audit"); }}package Com.flow.theory;public class Applyflow implements flow{@Override public void Action () {System.    OUT.PRINTLN ("Application"); }}package Com.flow.theory;public class Approveflow implements flow{@Override public void Action () {Syste    M.OUT.PRINTLN ("approval");        }}package Com.flow.theory;public class context{private flow flow;    public void Setflow (flow flow) {This.flow=flow; } public void Process ()   {flow.action (); }}

http://www.verejava.com/?id=16999114235569

Java Design Pattern Flow pattern

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.