April 2018
Intermediate to advanced
202 pages
4h 48m
English
How about a factory of components? The following is an implementation of a factory with a method that returns a Component:
public class LoginFormFactory {
public static Component getComponent() {
... create and configure all required components
return new VerticalLayout(
username, password, button, rememberMe);
}
}
This hides the implementation details but also makes it more difficult and complex to offer functionality to the clients. For example, how would clients of the class get the username or password values introduced by the user in the form? One option is to implement getters in the factory class, but that would require some more adjustments in the LoginFormFactory class. At the end of the day, this kind of implementation ...
Read now
Unlock full access