inblog logo
|
{CODE-RYU};
    #install

    롬복 (Lombok) 활용하기

    Jan 23, 2024
    롬복 (Lombok) 활용하기
     
    💡
    Lombok 이란 Java의 라이브러리로 반복되는 메소드를 Annotation 을 사용해서 자동으로 작성해주는 라이브러리다.
     
     
    Project Lombok
    Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
    Project Lombok
    https://projectlombok.org/
     
     
     
    notion image
     
    Lombok 사이트에서 install 을 들어가 원하는 툴을 선택한다.
     
    notion image
    dependencies { compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' }
     
    dependencies 값을 인텔리J 의 build.gradle 에 붙여넣은 후 오른 쪽 상단 코끼리 버튼을 누른다.
     
    notion image
     
     
     
    notion image
     
    그리고 settings - plugins - Installed 에서 Lombok 을 인스톨한다.
     
    notion image
     
    설정이 완료되면 @키워드를 작성하면 다른 코드를 쓰지 않아도 편하게 이용할 수 있다.
    위의 코드는 toString 과 모든 생성자, getter, setter 을 자동으로 만들어준다.
    Share article

    {CODE-RYU};

    RSS·Powered by Inblog