Coder Social home page Coder Social logo

dolphago / github-follower-tracker Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 930 KB

Check github follow/unfollow tracking service

License: MIT License

Java 84.27% Dockerfile 1.12% JavaScript 1.71% HTML 0.98% Vue 8.40% TypeScript 3.46% Shell 0.06%
feign jpa springbatch springboot

github-follower-tracker's Introduction

TEST

github-follower-tracker's People

Contributors

dolphago avatar

Watchers

 avatar

github-follower-tracker's Issues

Generic 고민

Follower, Following, Neighbor 모두 비슷한 데이터 형태들을 가지고 있어서,
MappedSuperclass를 상속시키고 제네릭으로 T extends {superclass} 를 만들어서 빌더 패턴으로 만들려고하니,
컴파일 시점까지는 괜찮지만, 런타임이 되자마자 엄청난 에러가 뿜뿜이다. abstract class인 super class로 생성자를 생성할 수 없다고 한다.

내가 생각했을 땐, 컴파일 시점에는 빌더를 활용하기 위해서 abstract class의 builder를 사용하다가
런타임 시점에 자식의 생성자를 쓰니까 문제가 없을 것이라고 생각했는데, 뭐 때문인거지, super 생성자 때문인가?
흠흠, 이전에 근데 잘 동작했었던 118번째 라인 을 보면, 제네릭으로 받고 있는 것 까지는 전혀 문제가 없어 보인다. abstract 객체를 만드는게 아니니깐 저거는, 그저 상위 타입이니까(인터페이스처럼).

 //TODO : 중복 코드를 줄이고 싶어서 다음과 같이 쓰고 싶은데, 에러 뿜뿜이다. 좋은 방법을 고안해보자.
//    private <T extends BaseEntity> List<T> create(List<MemberDto> memberDtos, List<Neighbor> neighbors, Class<T> cls) {
//        List<T> list = new ArrayList<>();
//        for (MemberDto memberDto : memberDtos) {
//            T t = MemberDto.toEntity(memberDto, cls);
//            list.add(t);
//        }
//
//        for (Neighbor neighbor : neighbors) {
//            T convert = convert(neighbor, cls);
//            list.add(convert);
//        }
//        return list;
//    }
//
//    private <T extends BaseEntity> T convert(BaseEntity neighbor, Class<T> cls) {
//        return (T) T.builder()
//                    .url(neighbor.getUrl())
//                    .githubLogin(neighbor.getGithubLogin())
//                    .build();
//
//    }
//    public static <T extends BaseEntity> T toEntity(MemberDto memberDto, Class<T> cls) { // 이런식으로 구현하고 싶은데 ㅠ.
//        return cls.cast(T.builder()
//                         .githubLogin(memberDto.getGithubLogin())
//                         .url(memberDto.getUrl())
//                         .build());
//    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.