Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
refactor : @NotNull remove
Browse files Browse the repository at this point in the history
- \'@NotNull\' 삭제
- Objects.requireNonNull로 대체
  • Loading branch information
loustler committed Nov 19, 2016
1 parent e197892 commit dc15595
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
13 changes: 5 additions & 8 deletions src/main/java/io/codechobo/member/application/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ public class MemberService {
/**
* Get mebmer list.
*
* @return MemberDto List if member not found is empty size
* @throws NullPointerException in case member list is null
* @return MemberDto list
*/
public List<MemberDto> getMembers() {
List<Member> memberList = memberRepository.findAll();
List<Member> member = memberRepository.findAll();

if(Objects.isNull(memberList)) return null;

return EntityDtoConverter.memberListConvertToDtoList(memberList);
return EntityDtoConverter.memberListConvertToDtoList(member);
}

/**
Expand All @@ -48,7 +45,7 @@ public List<MemberDto> getMembers() {
* @return Null | MemberDto
*/
public MemberDto getMember(final Long sequence) {
Member member = memberRepository.findOne(sequence);
Member member = memberRepository.findOne(Objects.requireNonNull(sequence));

if(Objects.isNull(member)) return null;

Expand All @@ -62,7 +59,7 @@ public MemberDto getMember(final Long sequence) {
* @return MemberDto
*/
public MemberDto createMember(final MemberDto memberDto) {
Member member = new Member(memberDto);
Member member = new Member(Objects.requireNonNull(memberDto));

if(Objects.isNull(member.getPoint()))
member.setPoint(new Integer(0));
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/io/codechobo/member/application/SocialService.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityNotFoundException;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -40,8 +39,8 @@ public List<SocialDto> all() {
* @return List if not found return empty size
* @throws NullPointerException in case not found any social
*/
public List<SocialDto> getSocials(@NotNull final Long memberSequence) {
List<Social> socialList = socialRepository.findByMemberSeq(memberSequence);
public List<SocialDto> getSocials(final Long memberSequence) {
List<Social> socialList = socialRepository.findByMemberSeq(Objects.requireNonNull(memberSequence));

if(Objects.isNull(socialList)) return null;

Expand All @@ -54,8 +53,8 @@ public List<SocialDto> getSocials(@NotNull final Long memberSequence) {
* @param socialSequence
* @return SocialDto
*/
public SocialDto getSocial(@NotNull final Long socialSequence) {
Social foundSocial = socialRepository.findOne(socialSequence);
public SocialDto getSocial(final Long socialSequence) {
Social foundSocial = socialRepository.findOne(Objects.requireNonNull(socialSequence));

return EntityDtoConverter.socialConvertToDto(foundSocial);
}
Expand All @@ -67,7 +66,7 @@ public SocialDto getSocial(@NotNull final Long socialSequence) {
* @return SocialDto
* @throws NullPointerException in case socialDto's member sequence is null
*/
public SocialDto createSocial(@NotNull final SocialDto socialDto) {
public SocialDto createSocial(final SocialDto socialDto) {
Member foundMember = memberRepository.findOne(Objects.requireNonNull(socialDto.getMemberSequence()));

Social social = EntityDtoConverter.socialDtoConvertToEntity(socialDto);
Expand All @@ -87,7 +86,7 @@ public SocialDto createSocial(@NotNull final SocialDto socialDto) {
* @throws EntityNotFoundException in case social sequence is null or not exist.
* @throws NullPointerException in case social sequence is null.
*/
public SocialDto updateSocial(@NotNull final SocialDto socialDto) {
public SocialDto updateSocial(final SocialDto socialDto) {
if (!socialRepository.exists(Objects.requireNonNull(socialDto.getSequence())))
throw new EntityNotFoundException(socialDto.getSequence()+" is not exist.");

Expand All @@ -108,7 +107,7 @@ public SocialDto updateSocial(@NotNull final SocialDto socialDto) {
* @param socialSequence NotNull
* @throws NullPointerException in case social sequence is null.
*/
public void deleteSocial(@NotNull final Long socialSequence) {
public void deleteSocial(final Long socialSequence) {
socialRepository.delete(Objects.requireNonNull(socialSequence));
}
}

0 comments on commit dc15595

Please sign in to comment.