Wednesday, November 12, 2014

Framework designing Tips

// if you are writing framework then the object identifatication level should be there for framework .For example Object Class is super for java .So,in framework specific we need a minimium definition of object how it should look like.Like for example of thee are suppose when loading in tomcat there are 2000 objects then 2000 object should have a common behaviour that is not default object class behaviour but our system specific behavior .Like Comapring is the object is null.Like a method check Object(Interface definition){

//interface.isNull(){
// so it works for all the objects of the system .So this functionality can be provided via frameork part
//}
 abstract class AbstractTest {
Object test;
void MethodSuper(){

}
AbstractTest(Object test){
this.test=test;

}
void Method2Super1(){

}
void Method2Super2(){

}
abstract void SubClassSpecified();



}
 abstract class AbstractTest1 {
Object test;
void MethodSuper2(){

}
AbstractTest1(Object test){
this.test=test;

}
void Method2Super2(){

}
abstract void SubClassSpecified();



}



public class AddBusineessLogic implements SuperCommonTask {

@Override
public void display() {
System.out.println("add result");

}

@Override
public void appliationErro() {
System.out.println("this is application error Add case ");

}

@Override
public void systemErro() {
System.out.println("this is systemerror Add case");

}

@Override
public void validatenput() {
}

@Override
public void ShowError() {
}

@Override
public void IsErrorPresent() {
}

}


public class BusinessLogic {
public int Add(int a,int b){
return a+b;
}
int Subtract(int a,int b){
return a-b;
}
int Divide(int a,int b){
return a%b;
}

}



public class ClientClass {
SuperCommonTask add = new AddBusineessLogic();
SuperCommonTask multiply = new MultiplyBusineessLogic();
SuperCommonTask divide = new DivideBusineessLogic();
CommonPointOfOperation CommonPointOfOperationadd = new CommonPointOfOperation(
add);
BusinessLogic businesslogic=new BusinessLogic();
void EntryPoint(int a ,int b){
add.validatenput();
}

}

public class CommonPointOfOperation {
SuperCommonTask SuperCommon;

CommonPointOfOperation(SuperCommonTask SuperCommon) {
this.SuperCommon = SuperCommon;
}

void ShowError() {
SuperCommon.appliationErro();
}

void ShowApplicationError() {
SuperCommon.appliationErro();
}

void ShowsystemError() {
SuperCommon.systemErro();

}
}

public class DivideBusineessLogic implements SuperCommonTask {
@Override
public void display() {
System.out.println("Multiply result");

}

@Override
public void appliationErro() {
System.out.println("this is application error Multiply case ");

}

@Override
public void systemErro() {
System.out.println("this is systemerror Multiply  case");

}

@Override
public void validatenput() {
// TODO Auto-generated method stub
}

@Override
public void ShowError() {
// TODO Auto-generated method stub
}

@Override
public void IsErrorPresent() {
// TODO Auto-generated method stub
}

}


public class InheritancePolymorphism {
void Method1(){
System.out.println("supermethod");
}

}


 class Client {
private State1 state;

public State1 getState() {
return state;
}

public void setState(State1 state) {
this.state = state;
}
}




public class Main {

/**
* @param args
*/
public static void main(String[] args) {
Client client=new Client();
client.setState(State1.cancel);
State1 state1=client.getState();
System.out.println(state1+ state1.getTest());
State1[] test=State1.values();
for(State1 state:test){
System.out.println(state.getTest()+state);;
}

}
}


public class MultiplyBusineessLogic implements SuperCommonTask {
@Override
public void display() {
System.out.println("Multiply result");

}

@Override
public void appliationErro() {
System.out.println("this is application error Multiply case ");

}

@Override
public void systemErro() {
System.out.println("this is systemerror Multiply  case");

}

@Override
public void validatenput() {
// TODO Auto-generated method stub
}

@Override
public void ShowError() {
// TODO Auto-generated method stub
}

@Override
public void IsErrorPresent() {
// TODO Auto-generated method stub
}

}

public class State1{
public static enum Test{
create("1")
,cancel("3")
,read("3")
,update("2")
,initread("3")
,initcancel("3")
,initupdate("3");

Test(String test){
this.test=test;
}
private String test;
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}

}
}
public interface SuperCommonTask {
void display();

void appliationErro();

void systemErro();
void validatenput();
void ShowError();
void IsErrorPresent();

}


No comments:

Post a Comment