abstract class DesignAnalysis0 {
protected boolean afterObjectOperation(boolean originalResult) {
return originalResult;
}
protected void beforeObjectChecked(Object object) {
System.out.println("DesignAnalysis");
Assert.assertNull("null values", object);
}
public boolean doAllErroeFreeOperation(Object object) {
beforeObjectChecked(object);
boolean result = doActualOperation(object);
return afterObjectOperation(result);
}
public abstract boolean doActualOperation(Object obj);
}
abstract class DesignAnalysis1 extends DesignAnalysis0 {
private Class type;
DesignAnalysis1(Class type){
this.type=type;
}
@Override
protected void beforeObjectChecked(Object object) {
if (!type.isAssignableFrom(object.getClass())) {
throw new IllegalArgumentException();
}
}
}
class DesignAnalysis2 extends DesignAnalysis1{
DesignAnalysis2(Class type) {
super(type);
// TODO Auto-generated constructor stub
}
@Override
public boolean doActualOperation(Object obj) {
System.out.println("DesignAnalysis2");
return false;
}
}
public class DesignAnalysis{
// DesignAnalysis2 test=new DesignAnalysis2();
}
No comments:
Post a Comment