Violation constructor 변경, 유틸리티 메소드 추가

master
mjkhan21 1 year ago
parent 643e1c5a21
commit d94165fc69

@ -661,11 +661,13 @@ public class Petition extends AbstractEntity {
private String reason; private String reason;
/**Violation() . /** .
* @param reason * @param reason
* @return Violation
*/ */
public Violation (String reason) { public Violation setReason(String reason) {
this.reason = reason; this.reason = reason;
return this;
} }
/** , . /** , .
@ -723,6 +725,23 @@ public class Petition extends AbstractEntity {
return found; return found;
} }
/**// .
* @param location
* @return //
*/
public String getDong(String location) {
if (Assert.isEmpty(location)) return "";
String[] suffix = {"동", "읍", "면"};
for (String token: location.split(" ")) {
for (String tail: suffix) {
if (token.endsWith(tail))
return token;
}
}
return "";
}
/** . /** .
* @param title * @param title
* @return * @return
@ -762,4 +781,10 @@ public class Petition extends AbstractEntity {
} }
} }
public static void main(String[] args) {
String[] locations = {"경기도 파주시 금촌동 798", "경기도 파주시 문산읍 당동리 892", "경기도 파주시 월롱면 덕은리 1300"};
Violation v = new Violation();
for (String loc: locations)
System.out.println(v.getDong(loc));
}
} }
Loading…
Cancel
Save