标签:AC IV this app .com 设计模式 RoCE static proc
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.out.println("审核");
}
}
package com.flow.theory;
public class ApplyFlow implements Flow
{
@Override
public void action()
{
System.out.println("申请");
}
}
package com.flow.theory;
public class ApproveFlow implements Flow
{
@Override
public void action()
{
System.out.println("审批");
}
}
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
标签:AC IV this app .com 设计模式 RoCE static proc
原文地址:https://www.cnblogs.com/verejava/p/9237037.html