feat: 들여쓰기

This commit is contained in:
2025-11-17 14:19:29 +09:00
parent 92f5b61114
commit dc9b40e78b
29 changed files with 735 additions and 777 deletions

View File

@@ -12,14 +12,14 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/hello")
public class HelloApiController {
private final HelloService helloService;
private final HelloService helloService;
@GetMapping
public HelloDto.Res hello(HelloDto.Req req) {
req.valid();
@GetMapping
public HelloDto.Res hello(HelloDto.Req req) {
req.valid();
Res res = helloService.sayHello(req);
Res res = helloService.sayHello(req);
return res;
}
return res;
}
}

View File

@@ -8,29 +8,29 @@ import lombok.Setter;
public class HelloDto {
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Req {
private String id;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Req {
private String id;
public void valid() {
if (id == null) {
throw new IllegalArgumentException(id);
}
}
public void valid() {
if (id == null) {
throw new IllegalArgumentException(id);
}
}
}
@Getter
public static class Res {
private String id;
private String name;
@Getter
public static class Res {
private String id;
private String name;
@Builder
public Res(String id, String name) {
this.id = id;
this.name = name;
}
@Builder
public Res(String id, String name) {
this.id = id;
this.name = name;
}
}
}

View File

@@ -13,26 +13,26 @@ import org.springframework.data.domain.Page;
*/
public interface BaseCoreService<T, ID, S> {
/**
* ID로 엔티티를 삭제합니다.
*
* @param id 삭제할 엔티티의 ID
*/
void remove(ID id);
/**
* ID로 엔티티를 삭제합니다.
*
* @param id 삭제할 엔티티의 ID
*/
void remove(ID id);
/**
* ID로 단건 조회합니다.
*
* @param id 조회할 엔티티의 ID
* @return 조회된 엔티티
*/
T getOneById(ID id);
/**
* ID로 단건 조회합니다.
*
* @param id 조회할 엔티티의 ID
* @return 조회된 엔티티
*/
T getOneById(ID id);
/**
* 검색 조건과 페이징으로 조회합니다.
*
* @param searchReq 검색 조건
* @return 페이징 처리된 검색 결과
*/
Page<T> search(S searchReq);
/**
* 검색 조건과 페이징으로 조회합니다.
*
* @param searchReq 검색 조건
* @return 페이징 처리된 검색 결과
*/
Page<T> search(S searchReq);
}

View File

@@ -9,9 +9,9 @@ import org.springframework.stereotype.Service;
@Service
public class HelloService {
public HelloDto.Res sayHello(HelloDto.Req req) {
log.info("hello");
String name = UUID.randomUUID().toString();
return HelloDto.Res.builder().id(req.getId()).name(name).build();
}
public HelloDto.Res sayHello(HelloDto.Req req) {
log.info("hello");
String name = UUID.randomUUID().toString();
return HelloDto.Res.builder().id(req.getId()).name(name).build();
}
}

View File

@@ -11,26 +11,26 @@ import org.springframework.util.StringUtils;
public class GeometryDeserializer<T extends Geometry> extends StdDeserializer<T> {
public GeometryDeserializer(Class<T> targetType) {
super(targetType);
public GeometryDeserializer(Class<T> targetType) {
super(targetType);
}
// TODO: test code
@SuppressWarnings("unchecked")
@Override
public T deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JacksonException {
String json = jsonParser.readValueAsTree().toString();
if (!StringUtils.hasText(json)) {
return null;
}
// TODO: test code
@SuppressWarnings("unchecked")
@Override
public T deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JacksonException {
String json = jsonParser.readValueAsTree().toString();
if (!StringUtils.hasText(json)) {
return null;
}
try {
GeoJsonReader reader = new GeoJsonReader();
return (T) reader.read(json);
} catch (Exception e) {
throw new IllegalArgumentException("Failed to deserialize GeoJSON into Geometry", e);
}
try {
GeoJsonReader reader = new GeoJsonReader();
return (T) reader.read(json);
} catch (Exception e) {
throw new IllegalArgumentException("Failed to deserialize GeoJSON into Geometry", e);
}
}
}

View File

@@ -10,22 +10,22 @@ import org.locationtech.jts.io.geojson.GeoJsonWriter;
public class GeometrySerializer<T extends Geometry> extends StdSerializer<T> {
// TODO: test code
public GeometrySerializer(Class<T> targetType) {
super(targetType);
}
// TODO: test code
public GeometrySerializer(Class<T> targetType) {
super(targetType);
}
@Override
public void serialize(
T geometry, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
throws IOException {
if (Objects.nonNull(geometry)) {
// default: 8자리 강제로 반올림시킴. 16자리로 늘려줌
GeoJsonWriter writer = new GeoJsonWriter(16);
String json = writer.write(geometry);
jsonGenerator.writeRawValue(json);
} else {
jsonGenerator.writeNull();
}
@Override
public void serialize(
T geometry, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
throws IOException {
if (Objects.nonNull(geometry)) {
// default: 8자리 강제로 반올림시킴. 16자리로 늘려줌
GeoJsonWriter writer = new GeoJsonWriter(16);
String json = writer.write(geometry);
jsonGenerator.writeRawValue(json);
} else {
jsonGenerator.writeNull();
}
}
}