Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create one "save builder" #111

Open
danilodeLuca opened this issue Nov 23, 2016 · 0 comments
Open

Create one "save builder" #111

danilodeLuca opened this issue Nov 23, 2016 · 0 comments

Comments

@danilodeLuca
Copy link

Create something like Yawp.builder().after(AfterAction).before(BeforeAction).execute();

Why do I need it?
I have several logics in my Hook and I don't need to validate all then in some places, but I need to do some validations before and/or after I save it.

class SaveBuilder<T> {

  public void after();
  public void before();
   public void execute(Object object) {
          before()
          Yawp.save(object)
          after()
   }
}
abstract class  BuilderAction<T> {

    public abstract void action(T object);
}

class AfterAction extends BuilderAction<MyClass> {
   @Override
   public void action(MyClass Object) {}
}

class BeforeAction extends BuilderAction<MyClass> {
   @Override
   public void action(MyClass Object) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant