4747/**parser for parsing request to JSONObject
4848 * @author Lemon
4949 */
50- public abstract class AbstractParser implements Parser , SQLCreator {
50+ public abstract class AbstractParser < T > implements Parser < T > , SQLCreator {
5151 protected static final String TAG = "AbstractParser" ;
5252
5353
@@ -76,28 +76,28 @@ public AbstractParser(RequestMethod method, boolean noVerify) {
7676 }
7777
7878 @ NotNull
79- protected Visitor visitor ;
79+ protected Visitor < T > visitor ;
8080 @ NotNull
8181 @ Override
82- public Visitor getVisitor () {
82+ public Visitor < T > getVisitor () {
8383 if (visitor == null ) {
84- visitor = new Visitor () {
84+ visitor = new Visitor < T > () {
8585
8686 @ Override
87- public Long getId () {
88- return 0L ;
87+ public T getId () {
88+ return null ;
8989 }
9090
9191 @ Override
92- public List <Long > getContactIdList () {
92+ public List <T > getContactIdList () {
9393 return null ;
9494 }
9595 };
9696 }
9797 return visitor ;
9898 }
9999 @ Override
100- public AbstractParser setVisitor (@ NotNull Visitor visitor ) {
100+ public AbstractParser < T > setVisitor (@ NotNull Visitor < T > visitor ) {
101101 this .visitor = visitor ;
102102 return this ;
103103 }
@@ -110,7 +110,7 @@ public RequestMethod getMethod() {
110110 }
111111 @ NotNull
112112 @ Override
113- public AbstractParser setMethod (RequestMethod method ) {
113+ public AbstractParser < T > setMethod (RequestMethod method ) {
114114 this .requestMethod = method == null ? GET : method ;
115115 return this ;
116116 }
@@ -121,25 +121,25 @@ public JSONObject getRequest() {
121121 return requestObject ;
122122 }
123123 @ Override
124- public AbstractParser setRequest (JSONObject request ) {
124+ public AbstractParser < T > setRequest (JSONObject request ) {
125125 this .requestObject = request ;
126126 return this ;
127127 }
128128
129129
130- protected Verifier verifier ;
130+ protected Verifier < T > verifier ;
131131 protected RequestRole globleRole ;
132- public AbstractParser setGlobleRole (RequestRole globleRole ) {
132+ public AbstractParser < T > setGlobleRole (RequestRole globleRole ) {
133133 this .globleRole = globleRole ;
134134 return this ;
135135 }
136136 protected String globleDatabase ;
137- public AbstractParser setGlobleDatabase (String globleDatabase ) {
137+ public AbstractParser < T > setGlobleDatabase (String globleDatabase ) {
138138 this .globleDatabase = globleDatabase ;
139139 return this ;
140140 }
141141 protected boolean globleFormat ;
142- public AbstractParser setGlobleFormat (Boolean globleFormat ) {
142+ public AbstractParser < T > setGlobleFormat (Boolean globleFormat ) {
143143 this .globleFormat = globleFormat ;
144144 return this ;
145145 }
@@ -149,7 +149,7 @@ public boolean isNoVerify() {
149149 return noVerifyLogin && noVerifyRole && noVerifyContent ;
150150 }
151151 @ Override
152- public AbstractParser setNoVerify (boolean noVerify ) {
152+ public AbstractParser < T > setNoVerify (boolean noVerify ) {
153153 setNoVerifyLogin (noVerify );
154154 setNoVerifyRole (noVerify );
155155 setNoVerifyContent (noVerify );
@@ -162,7 +162,7 @@ public boolean isNoVerifyLogin() {
162162 return noVerifyLogin ;
163163 }
164164 @ Override
165- public AbstractParser setNoVerifyLogin (boolean noVerifyLogin ) {
165+ public AbstractParser < T > setNoVerifyLogin (boolean noVerifyLogin ) {
166166 this .noVerifyLogin = noVerifyLogin ;
167167 return this ;
168168 }
@@ -172,7 +172,7 @@ public boolean isNoVerifyRole() {
172172 return noVerifyRole ;
173173 }
174174 @ Override
175- public AbstractParser setNoVerifyRole (boolean noVerifyRole ) {
175+ public AbstractParser < T > setNoVerifyRole (boolean noVerifyRole ) {
176176 this .noVerifyRole = noVerifyRole ;
177177 return this ;
178178 }
@@ -182,7 +182,7 @@ public boolean isNoVerifyContent() {
182182 return noVerifyContent ;
183183 }
184184 @ Override
185- public AbstractParser setNoVerifyContent (boolean noVerifyContent ) {
185+ public AbstractParser < T > setNoVerifyContent (boolean noVerifyContent ) {
186186 this .noVerifyContent = noVerifyContent ;
187187 return this ;
188188 }
@@ -1123,7 +1123,7 @@ public synchronized JSONObject executeSQL(SQLConfig config) throws Exception {
11231123 if (globleRole != null ) {
11241124 config .setRole (globleRole );
11251125 } else {
1126- config .setRole (getVisitor ().getId () <= 0 ? RequestRole .UNKNOWN : RequestRole .LOGIN );
1126+ config .setRole (getVisitor ().getId () == null ? RequestRole .UNKNOWN : RequestRole .LOGIN );
11271127 }
11281128 }
11291129 verifier .verify (config );
0 commit comments