Skip to content

Commit

Permalink
feat : 정책 신청 방법 Enum 타입 구현
Browse files Browse the repository at this point in the history
      ( 온라인신청, 방문신청, 우편신청, 그 외 )
  • Loading branch information
LHS-11 committed Dec 21, 2023
1 parent 0d2fa84 commit c57dfe7
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.cmc.zenefitserver.domain.policy.domain.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

@Getter
public enum PolicyMethodType {

ONLINE("온라인신청", Arrays.asList("온라인", "누리집", "홈페이지", "포털", "블로그", "이메일", "모바일", "email", "e-mail", "e-메일", "팩스", "전화", "워크넷", "https", "www")),
LETTER("우편신청", Arrays.asList("우편")),
VISIT("방문신청", Arrays.asList("방문", "읍면", "사무소", "사무실", "센터", "관할", "내방")),
BLANK("빈값", Collections.emptyList());

private final String description;

private final List<String> keywords;

PolicyMethodType(String description, List<String> keywords) {
this.description = description;
this.keywords = keywords;
}

public static PolicyMethodType findPolicyMethodTypeByKeywords(String text) {
return Arrays.stream(PolicyMethodType.values())
.filter(policyMethodType -> policyMethodType.keywords.stream().anyMatch(text::contains))
.findFirst()
.orElse(BLANK);
}
}

0 comments on commit c57dfe7

Please sign in to comment.