Download - Qi4j
![Page 1: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/1.jpg)
QI4j
![Page 2: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/2.jpg)
What is
● Framework● Composite Oriented Programming● DDD● Aop● DI
![Page 3: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/3.jpg)
Principles
![Page 4: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/4.jpg)
OOP is Class Oriented
![Page 5: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/5.jpg)
Behavior Depends on Context
![Page 6: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/6.jpg)
![Page 7: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/7.jpg)
![Page 8: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/8.jpg)
Decoupling is Virtue
![Page 9: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/9.jpg)
Business Rules matters more
![Page 10: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/10.jpg)
Solution
![Page 11: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/11.jpg)
Fragments
![Page 12: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/12.jpg)
Composite
![Page 13: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/13.jpg)
HelloWorld
public interface HelloWorld extends HelloWorldBehaviour, HelloWorldState {
}
![Page 14: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/14.jpg)
Behaviour
@Mixins( HelloWorldBehaviourMixin.class )
public interface HelloWorldBehaviour
{
String say();
}
![Page 15: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/15.jpg)
Impl
public class HelloWorldBehaviourMixin
implements HelloWorldBehaviour
{
@This HelloWorldState state;
public String say()
{
return state.getPhrase() + " " + state.getName();
}
}
![Page 16: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/16.jpg)
State
@Mixins( HelloWorldStateMixin.class )
public interface HelloWorldState
{
void setPhrase(@NotEmpty String phrase )
throws IllegalArgumentException;
String getPhrase();
void setName( @NotEmpty String name )
throws IllegalArgumentException;
String getName();
}
![Page 17: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/17.jpg)
Running
TransientBuilderFactory factory = assembler.transientBuilderFactory();
HelloWorld olaMundo = factory.newTransient( HelloWorldComposite.class );
olaMundo.setName("Jeff");
olaMundo.setPhrase("adoro mac");
System.out.println( olaMundo.say() );
![Page 18: Qi4j](https://reader034.vdocument.in/reader034/viewer/2022051513/54624943b4af9f4e1c8b4700/html5/thumbnails/18.jpg)