In a similar fashion as with @Mapping for PageFragement subclasses we could validate if a Page was initialized for a valid context path / url.
Examples
@ContextPath("/html/index")
public interface LandingPage extends Page {
// implementation
}
- If the currently displayed page had the URL
http://localhost/html/index and an instance of LandingPage is created there would be no problem since the context path matches the expectation.
- If the currently displayed page had the URL
http://localhost/html/main an exception would be thrown as soon as a LandingPage instance is being created.
- For page definitions without
@ContextPath every URL is valid