Skip to content

Commit 838f901

Browse files
committed
チェックスタイルの指摘の修正
1 parent 1764b3c commit 838f901

File tree

2 files changed

+80
-13
lines changed

2 files changed

+80
-13
lines changed

config/stylecheck.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ Slightly modified version of Sun Checks that better matches the default code for
2929
<module name="LocalFinalVariableName"/>
3030
<module name="LocalVariableName"/>
3131
<module name="MemberName"/>
32-
<module name="MethodName"/>
32+
<module name="MethodName">
33+
<property name="severity" value="ignore"/>
34+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
35+
</module>
3336
<module name="PackageName"/>
3437
<module name="ParameterName"/>
3538
<module name="StaticVariableName"/>
@@ -41,7 +44,10 @@ Slightly modified version of Sun Checks that better matches the default code for
4144
<module name="LineLength">
4245
<property name="max" value="150"/>
4346
</module>
44-
<module name="MethodLength"/>
47+
<module name="MethodLength">
48+
<property name="severity" value="ignore"/>
49+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
50+
</module>
4551
<module name="ParameterNumber"/>
4652
<module name="EmptyForIteratorPad"/>
4753
<module name="GenericWhitespace"/>

src/main/java/org/support/project/web/control/Control.java

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
import javax.servlet.http.HttpServletRequest;
1313
import javax.servlet.http.HttpServletResponse;
1414

15-
import net.arnx.jsonic.JSON;
16-
import net.arnx.jsonic.JSONException;
17-
1815
import org.support.project.common.bean.ValidateError;
1916
import org.support.project.common.config.CommonBaseParameter;
2017
import org.support.project.common.config.Resources;
@@ -43,6 +40,10 @@
4340
import org.support.project.web.config.MessageStatus;
4441
import org.support.project.web.control.service.Get;
4542
import org.support.project.web.exception.InvalidParamException;
43+
import org.support.project.web.logic.impl.DefaultAuthenticationLogicImpl;
44+
45+
import net.arnx.jsonic.JSON;
46+
import net.arnx.jsonic.JSONException;
4647

4748
/**
4849
* Controlの基底クラス
@@ -69,9 +70,9 @@ public abstract class Control {
6970

7071
/** リソース */
7172
protected Resources resources = Resources.getInstance(CommonBaseParameter.APP_RESOURCE);
72-
73+
/** Viewのベースパス */
7374
public static final String BASE_PATH = "/WEB-INF/views";
74-
75+
/** HTMLエスケープして送信するかのフラグ */
7576
private boolean sendEscapeHtml = true;
7677

7778
/**
@@ -158,7 +159,7 @@ protected String getForwardDir() {
158159
if (StringUtils.isNotEmpty(subPackageName)) {
159160
if (subPackageName.indexOf("\\.") != -1) {
160161
String[] packages = StringUtils.split(subPackageName, ".");
161-
for (int i = packages.length -1; i <= 0; i--) {
162+
for (int i = packages.length - 1; i <= 0; i--) {
162163
String string = packages[i];
163164
builder.append(string).append("/");
164165
}
@@ -467,35 +468,73 @@ public Integer getLoginUserId() {
467468
return loginedUser.getLoginUser().getUserId();
468469
}
469470

470-
471+
/**
472+
* request を取得
473+
* @return
474+
*/
471475
public HttpServletRequest getRequest() {
472476
return request;
473477
}
478+
/**
479+
* request をセット
480+
* @return
481+
*/
474482
public void setRequest(HttpServletRequest request) {
475483
this.request = request;
476484
}
485+
/**
486+
* response を取得
487+
* @return
488+
*/
477489
public HttpServletResponse getResponse() {
478490
return response;
479491
}
492+
/**
493+
* response をセット
494+
* @return
495+
*/
480496
public void setResponse(HttpServletResponse response) {
481497
this.response = response;
482498
}
499+
/**
500+
* invokeTarget を取得
501+
* @return
502+
*/
483503
public InvokeTarget getInvokeTarget() {
484504
return invokeTarget;
485505
}
486-
506+
/**
507+
* invokeTarget をセット
508+
* @return
509+
*/
487510
public void setInvokeTarget(InvokeTarget invokeTarget) {
488511
this.invokeTarget = invokeTarget;
489512
}
513+
/**
514+
* path を取得
515+
* @return
516+
*/
490517
public String getPath() {
491518
return path;
492519
}
520+
/**
521+
* path をセット
522+
* @return
523+
*/
493524
public void setPath(String path) {
494525
this.path = path;
495526
}
527+
/**
528+
* pathInfo を取得
529+
* @return
530+
*/
496531
public String getPathInfo() {
497532
return pathInfo;
498533
}
534+
/**
535+
* pathInfo をセット
536+
* @return
537+
*/
499538
public void setPathInfo(String pathInfo) {
500539
this.pathInfo = pathInfo;
501540
}
@@ -622,23 +661,35 @@ protected String getParamWithDefault(String paramName, String defaultval) {
622661
}
623662
}
624663

625-
664+
/**
665+
* パラメータを取得
666+
* @param paramName
667+
* @param type
668+
* @return
669+
*/
626670
protected <T> T getParam(String paramName, Class<? extends T> type) {
627671
try {
628672
return HttpUtil.getParameter(request, paramName, type);
629673
} catch (InvalidParamException e) {
630674
throw new SystemException(e);
631675
}
632676
}
633-
677+
/**
678+
* パラメータを取得
679+
* @param type
680+
* @return
681+
*/
634682
protected <T> T getParams(Class<? extends T> type) {
635683
try {
636684
return HttpUtil.parseRequest(request, type);
637685
} catch (InstantiationException | IllegalAccessException | JSONException | IOException | InvalidParamException e) {
638686
throw new SystemException(e);
639687
}
640688
}
641-
689+
/**
690+
* パラメータをマップで取得
691+
* @return
692+
*/
642693
protected Map<String, String> getParams() {
643694
Map<String, String> map = new HashMap<>();
644695
Enumeration<String> enumeration = request.getParameterNames();
@@ -664,6 +715,16 @@ public void setSendEscapeHtml(boolean sendEscapeHtml) {
664715
this.sendEscapeHtml = sendEscapeHtml;
665716
}
666717

718+
/**
719+
* パラメータをオブジェクトにセットして取得
720+
* @param type
721+
* @return
722+
* @throws InstantiationException
723+
* @throws IllegalAccessException
724+
* @throws JSONException
725+
* @throws IOException
726+
* @throws InvalidParamException
727+
*/
667728
public <T> T getParamOnProperty(final Class<? extends T> type)
668729
throws InstantiationException, IllegalAccessException, JSONException, IOException, InvalidParamException {
669730
return HttpUtil.parseRequest(request, type);

0 commit comments

Comments
 (0)