티스토리 뷰

공부

[Java] lombok @ToString (CSV, Fields)

seunggabi 승가비 2020. 6. 18. 20:48
@ToString(callSuper=true, includeFieldNames=false)
public String csv() {
  String name = this.toString();
  name = name.replace(MergeResult.class.getSimpleName(), "");
  name = name.substring(1, name.length()-1);
  name = name.replaceAll(CommonUtils.DELIMITER+" ", CommonUtils.DELIMITER);
  return name;
}

public static String fields() {
  return Arrays.stream(MergeResult.class.getDeclaredFields())
    .map(Field::getName)
    .reduce((a, b) -> a+CommonUtils.DELIMITER+b)
    .orElse("");
}

https://projectlombok.org/features/ToString

 

@ToString

 

projectlombok.org

 

'공부' 카테고리의 다른 글

[SQL] pivot table  (0) 2020.06.18
[Hive] SHOW TABLES FROM `db`  (0) 2020.06.18
[Java] lombok @ToString (CSV, Fields)  (0) 2020.06.18
[Python] flask redirect  (0) 2020.06.18
[Python] timedelta  (0) 2020.06.18
[Python] Running setup.py install for mysqlclient ... error  (0) 2020.06.18
댓글
댓글쓰기 폼