-
Notifications
You must be signed in to change notification settings - Fork 8
@Page()
kyleduo edited this page Mar 12, 2018
·
1 revision
@Page is an annotation used to name a page. I’m going to introduce you the fields you can set in this annotation.
Example:
@Page(value = "/test", alias = "TEST_ACT", flags = 1, variety = {"/test/{param}"})- value This is the default field containing the path of the page. You can emit this field name if it is the only one.
-
alias Alias is used when generating P class. When alias is specified, there will be a String constants named what you set. For previous example, you can use
P.TEST_ACTinto()method to specify this page. - flags An integer flags marked on this page which can be used in Interceptors. You can use every bit to define some meaning. I learnt this from aRouter.
- variety Used when a page has more than one url.
You can annotate a page use url in this format:
(SCHEME://DOMAIN)/PATH/PATH
- Scheme and Domain is not required, but should be used together. Full formatted url can only match urls has the same scheme and domain, whatever what the default ones specific by RabbitConfig are.
- You can specify param in url to create RESTful style Url.
- Here is an example:
"/test/{param}". - You can specific the type of param like this:
"/test/{param:s}, “s” means String. Rabbits also support int as “i”, long as “l”, float as “f”, double as “d” and boolean as “b”.
- Here is an example:
- Urls in variety array has the same value as the main one except Rabbits will not create constants for them, for clarity purpose.****