Function bodies 391 total
ModelRelationRequest function · java · L8-L13 (6 LOC)src/main/java/live/yurii/autocatalog/api/model/ModelRelationRequest.java
public record ModelRelationRequest(
@NotNull UUID targetModelId,
@NotNull ModelRelation.Type type,
String note
) {
}GlobalExceptionHandler class · java · L12-L44 (33 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public class GlobalExceptionHandler {
@ExceptionHandler(EntityNotFoundException.class)
public ProblemDetail handleNotFound(EntityNotFoundException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, ex.getMessage());
}
@ExceptionHandler(IllegalStateException.class)
public ProblemDetail handleConflict(IllegalStateException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT, ex.getMessage());
}
@ExceptionHandler(DataIntegrityViolationException.class)
public ProblemDetail handleDataIntegrity(DataIntegrityViolationException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT,
"Data integrity violation: a uniqueness or referential constraint was broken");
}
@ExceptionHandler(IllegalArgumentException.class)
public ProblemDetail handleBadRequest(IllegalArgumentException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, ex.getMessage());
}
@ExceptionHandler(MethodArgumentNotValhandleNotFound method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public ProblemDetail handleNotFound(EntityNotFoundException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, ex.getMessage());
}handleConflict method · java · L20-L22 (3 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public ProblemDetail handleConflict(IllegalStateException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT, ex.getMessage());
}handleDataIntegrity method · java · L25-L28 (4 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public ProblemDetail handleDataIntegrity(DataIntegrityViolationException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT,
"Data integrity violation: a uniqueness or referential constraint was broken");
}handleBadRequest method · java · L31-L33 (3 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public ProblemDetail handleBadRequest(IllegalArgumentException ex) {
return ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, ex.getMessage());
}handleValidation method · java · L36-L43 (8 LOC)src/main/java/live/yurii/autocatalog/api/shared/GlobalExceptionHandler.java
public ProblemDetail handleValidation(MethodArgumentNotValidException ex) {
var detail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, "Validation failed");
detail.setProperty("errors", ex.getBindingResult().getFieldErrors().stream()
.map(e -> e.getField() + ": " + e.getDefaultMessage())
.toList()
);
return detail;
}Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
TransmissionController class · java · L25-L56 (32 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionController.java
public class TransmissionController {
private final TransmissionService transmissionService;
public TransmissionController(TransmissionService transmissionService) {
this.transmissionService = transmissionService;
}
@GetMapping
@Operation(summary = "Get all transmissions")
public List<TransmissionResponse> getAll(@RequestParam(required = false) TransmissionType type) {
var list = type != null
? transmissionService.getByType(type)
: transmissionService.getAll();
return list.stream().map(TransmissionResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get transmission by ID")
public TransmissionResponse getById(@PathVariable UUID id) {
return TransmissionResponse.from(transmissionService.getById(new TransmissionId(id)));
}
@PostMapping
@Operation(summary = "Create a new transmission")
public ResponseEntity<TransmissionResponse> create(@Valid @RequestBody TransmissionRequest request) {
var transmission = trTransmissionController method · java · L29-L31 (3 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionController.java
public TransmissionController(TransmissionService transmissionService) {
this.transmissionService = transmissionService;
}getById method · java · L44-L46 (3 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionController.java
public TransmissionResponse getById(@PathVariable UUID id) {
return TransmissionResponse.from(transmissionService.getById(new TransmissionId(id)));
}create method · java · L50-L55 (6 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionController.java
public ResponseEntity<TransmissionResponse> create(@Valid @RequestBody TransmissionRequest request) {
var transmission = transmissionService.create(request.type(), request.gearCount());
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(transmission.id().value()).toUri();
return ResponseEntity.created(uri).body(TransmissionResponse.from(transmission));
}TransmissionRequest class · java · L8-L12 (5 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionRequest.java
public record TransmissionRequest(
@NotNull TransmissionType type,
@Min(1) @Max(12) int gearCount
) {
}TransmissionResponse function · java · L7-L12 (6 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionResponse.java
public record TransmissionResponse(UUID id, String type, int gearCount) {
public static TransmissionResponse from(Transmission t) {
return new TransmissionResponse(t.id().value(), t.type().name(), t.gearCount());
}
}TransmissionResponse class · java · L7-L12 (6 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionResponse.java
public record TransmissionResponse(UUID id, String type, int gearCount) {
public static TransmissionResponse from(Transmission t) {
return new TransmissionResponse(t.id().value(), t.type().name(), t.gearCount());
}
}from method · java · L9-L11 (3 LOC)src/main/java/live/yurii/autocatalog/api/transmission/TransmissionResponse.java
public static TransmissionResponse from(Transmission t) {
return new TransmissionResponse(t.id().value(), t.type().name(), t.gearCount());
}Repobility (the analyzer behind this table) · https://repobility.com
VariantController class · java · L31-L90 (60 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public class VariantController {
private final VariantService variantService;
public VariantController(VariantService variantService) {
this.variantService = variantService;
}
@GetMapping
@Operation(summary = "Get variants by body")
public List<VariantResponse> getByBody(@RequestParam UUID bodyId) {
return variantService.getByBody(new BodyId(bodyId)).stream()
.map(VariantResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get variant by ID")
public VariantResponse getById(@PathVariable UUID id) {
return VariantResponse.from(variantService.getById(new VariantId(id)));
}
@PostMapping
@Operation(summary = "Create a new variant")
public ResponseEntity<VariantResponse> create(@Valid @RequestBody VariantRequest request) {
var variant = variantService.create(
new BodyId(request.bodyId()),
new TransmissionId(request.transmissionId()),
request.drivetrain(),
request.curbWeightKg(),
request.groVariantController method · java · L35-L37 (3 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public VariantController(VariantService variantService) {
this.variantService = variantService;
}getByBody method · java · L41-L44 (4 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public List<VariantResponse> getByBody(@RequestParam UUID bodyId) {
return variantService.getByBody(new BodyId(bodyId)).stream()
.map(VariantResponse::from).toList();
}getById method · java · L48-L50 (3 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public VariantResponse getById(@PathVariable UUID id) {
return VariantResponse.from(variantService.getById(new VariantId(id)));
}create method · java · L54-L66 (13 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public ResponseEntity<VariantResponse> create(@Valid @RequestBody VariantRequest request) {
var variant = variantService.create(
new BodyId(request.bodyId()),
new TransmissionId(request.transmissionId()),
request.drivetrain(),
request.curbWeightKg(),
request.groundClearanceMm(),
request.systemPowerKw()
);
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(variant.id().value()).toUri();
return ResponseEntity.created(uri).body(VariantResponse.from(variant));
}addEngine method · java · L70-L74 (5 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public VariantResponse addEngine(@PathVariable UUID id, @PathVariable UUID engineId) {
return VariantResponse.from(
variantService.addEngine(new VariantId(id), new EngineId(engineId))
);
}addMarket method · java · L78-L82 (5 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public VariantResponse addMarket(@PathVariable UUID id, @PathVariable String market) {
return VariantResponse.from(
variantService.addMarket(new VariantId(id), market)
);
}deleteById method · java · L87-L89 (3 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantController.java
public void deleteById(@PathVariable UUID id) {
variantService.deleteById(new VariantId(id));
}Open data scored by Repobility · https://repobility.com
VariantRequest class · java · L9-L17 (9 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantRequest.java
public record VariantRequest(
@NotNull UUID bodyId,
@NotNull UUID transmissionId,
@NotNull Drivetrain drivetrain,
@Min(1) int curbWeightKg,
@Min(1) Integer groundClearanceMm,
@Min(1) Integer systemPowerKw
) {
}VariantResponse class · java · L10-L34 (25 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantResponse.java
public record VariantResponse(
UUID id,
UUID bodyId,
Set<UUID> engineIds,
UUID transmissionId,
String drivetrain,
Integer groundClearanceMm,
int curbWeightKg,
Integer systemPowerKw,
Set<String> markets
) {
public static VariantResponse from(Variant v) {
return new VariantResponse(
v.id().value(),
v.bodyId().value(),
v.engineIds().stream().map(EngineId::value).collect(Collectors.toSet()),
v.transmissionId().value(),
v.drivetrain().name(),
v.groundClearanceMm(),
v.curbWeightKg(),
v.systemPowerKw(),
v.markets()
);
}
}VariantResponse function · java · L10-L34 (25 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantResponse.java
public record VariantResponse(
UUID id,
UUID bodyId,
Set<UUID> engineIds,
UUID transmissionId,
String drivetrain,
Integer groundClearanceMm,
int curbWeightKg,
Integer systemPowerKw,
Set<String> markets
) {
public static VariantResponse from(Variant v) {
return new VariantResponse(
v.id().value(),
v.bodyId().value(),
v.engineIds().stream().map(EngineId::value).collect(Collectors.toSet()),
v.transmissionId().value(),
v.drivetrain().name(),
v.groundClearanceMm(),
v.curbWeightKg(),
v.systemPowerKw(),
v.markets()
);
}
}from method · java · L21-L33 (13 LOC)src/main/java/live/yurii/autocatalog/api/variant/VariantResponse.java
public static VariantResponse from(Variant v) {
return new VariantResponse(
v.id().value(),
v.bodyId().value(),
v.engineIds().stream().map(EngineId::value).collect(Collectors.toSet()),
v.transmissionId().value(),
v.drivetrain().name(),
v.groundClearanceMm(),
v.curbWeightKg(),
v.systemPowerKw(),
v.markets()
);
}BodyService class · java · L13-L49 (37 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public class BodyService {
private final BodyRepository bodyRepository;
private final GenerationRepository generationRepository;
public BodyService(BodyRepository bodyRepository, GenerationRepository generationRepository) {
this.bodyRepository = bodyRepository;
this.generationRepository = generationRepository;
}
public Body create(GenerationId generationId, BodyStyle bodyStyle,
int lengthMm, int widthMm, int heightMm, int wheelbaseMm,
Integer trunkVolumeLitres) {
if (generationRepository.findById(generationId).isEmpty())
throw new EntityNotFoundException("Generation not found: " + generationId.value());
if (bodyRepository.existsByGenerationIdAndBodyStyle(generationId, bodyStyle))
throw new IllegalStateException(
"Body already exists for generation " + generationId.value() + " with style " + bodyStyle);
var body = Body.create(generationId, bodyStyle, lengthMm, widthMm, heightMm, wheelbaseMm);
BodyService method · java · L18-L21 (4 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public BodyService(BodyRepository bodyRepository, GenerationRepository generationRepository) {
this.bodyRepository = bodyRepository;
this.generationRepository = generationRepository;
}create method · java · L23-L34 (12 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public Body create(GenerationId generationId, BodyStyle bodyStyle,
int lengthMm, int widthMm, int heightMm, int wheelbaseMm,
Integer trunkVolumeLitres) {
if (generationRepository.findById(generationId).isEmpty())
throw new EntityNotFoundException("Generation not found: " + generationId.value());
if (bodyRepository.existsByGenerationIdAndBodyStyle(generationId, bodyStyle))
throw new IllegalStateException(
"Body already exists for generation " + generationId.value() + " with style " + bodyStyle);
var body = Body.create(generationId, bodyStyle, lengthMm, widthMm, heightMm, wheelbaseMm);
if (trunkVolumeLitres != null) body.setTrunkVolumeLitres(trunkVolumeLitres);
return bodyRepository.save(body);
}getById method · java · L36-L39 (4 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public Body getById(BodyId id) {
return bodyRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Body not found: " + id.value()));
}All rows above produced by Repobility · https://repobility.com
getByGeneration method · java · L41-L43 (3 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public List<Body> getByGeneration(GenerationId generationId) {
return bodyRepository.findByGenerationId(generationId);
}deleteById method · java · L45-L48 (4 LOC)src/main/java/live/yurii/autocatalog/application/body/BodyService.java
public void deleteById(BodyId id) {
getById(id);
bodyRepository.deleteById(id);
}EngineService class · java · L11-L44 (34 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public class EngineService {
private final EngineRepository engineRepository;
public EngineService(EngineRepository engineRepository) {
this.engineRepository = engineRepository;
}
public Engine create(String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int torqueNm,
Integer cylinderCount, String configuration,
Integer systemPowerKw) {
if (engineRepository.existsByCode(code))
throw new IllegalStateException("Engine already exists: " + code);
var engine = Engine.create(code, name, fuelType, displacementCc, powerKw, torqueNm);
if (cylinderCount != null) engine.setCylinderCount(cylinderCount);
if (configuration != null) engine.setConfiguration(configuration);
if (systemPowerKw != null) engine.setSystemPowerKw(systemPowerKw);
return engineRepository.save(engine);
}
public Engine getById(EngineId id) {
return engineRepository.findById(id)
EngineService method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public EngineService(EngineRepository engineRepository) {
this.engineRepository = engineRepository;
}create method · java · L19-L30 (12 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public Engine create(String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int torqueNm,
Integer cylinderCount, String configuration,
Integer systemPowerKw) {
if (engineRepository.existsByCode(code))
throw new IllegalStateException("Engine already exists: " + code);
var engine = Engine.create(code, name, fuelType, displacementCc, powerKw, torqueNm);
if (cylinderCount != null) engine.setCylinderCount(cylinderCount);
if (configuration != null) engine.setConfiguration(configuration);
if (systemPowerKw != null) engine.setSystemPowerKw(systemPowerKw);
return engineRepository.save(engine);
}getById method · java · L32-L35 (4 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public Engine getById(EngineId id) {
return engineRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Engine not found: " + id.value()));
}getAll method · java · L37-L39 (3 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public List<Engine> getAll() {
return engineRepository.findAll();
}getByFuelType method · java · L41-L43 (3 LOC)src/main/java/live/yurii/autocatalog/application/engine/EngineService.java
public List<Engine> getByFuelType(FuelType fuelType) {
return engineRepository.findByFuelType(fuelType);
}Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
GenerationService class · java · L13-L46 (34 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public class GenerationService {
private final GenerationRepository generationRepository;
private final CarModelRepository modelRepository;
public GenerationService(GenerationRepository generationRepository,
CarModelRepository modelRepository) {
this.generationRepository = generationRepository;
this.modelRepository = modelRepository;
}
public Generation create(ModelId modelId, String name, YearRange years) {
if (modelRepository.findById(modelId).isEmpty())
throw new EntityNotFoundException("Model not found: " + modelId.value());
if (generationRepository.existsByModelIdAndName(modelId, name))
throw new IllegalStateException("Generation already exists for model " + modelId.value() + ": " + name);
return generationRepository.save(Generation.create(modelId, name, years));
}
public Generation getById(GenerationId id) {
return generationRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundExceptionGenerationService method · java · L18-L22 (5 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public GenerationService(GenerationRepository generationRepository,
CarModelRepository modelRepository) {
this.generationRepository = generationRepository;
this.modelRepository = modelRepository;
}create method · java · L24-L30 (7 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public Generation create(ModelId modelId, String name, YearRange years) {
if (modelRepository.findById(modelId).isEmpty())
throw new EntityNotFoundException("Model not found: " + modelId.value());
if (generationRepository.existsByModelIdAndName(modelId, name))
throw new IllegalStateException("Generation already exists for model " + modelId.value() + ": " + name);
return generationRepository.save(Generation.create(modelId, name, years));
}getById method · java · L32-L35 (4 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public Generation getById(GenerationId id) {
return generationRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Generation not found: " + id.value()));
}getByModel method · java · L37-L39 (3 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public List<Generation> getByModel(ModelId modelId) {
return generationRepository.findByModelId(modelId);
}close method · java · L41-L45 (5 LOC)src/main/java/live/yurii/autocatalog/application/generation/GenerationService.java
public Generation close(GenerationId generationId, int year) {
var generation = getById(generationId);
generation.close(year);
return generationRepository.save(generation);
}MakeService class · java · L10-L43 (34 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public class MakeService {
private final MakeRepository makeRepository;
public MakeService(MakeRepository makeRepository) {
this.makeRepository = makeRepository;
}
public Make create(String name, String country) {
if (makeRepository.existsByName(name))
throw new IllegalStateException("Make already exists: " + name);
return makeRepository.save(Make.create(name, country));
}
public Make getById(MakeId id) {
return makeRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Make not found: " + id.value()));
}
public Make getBySlug(String slug) {
return makeRepository.findBySlug(slug)
.orElseThrow(() -> new EntityNotFoundException("Make not found: " + slug));
}
public List<Make> getAll() {
return makeRepository.findAll();
}
public Make rename(MakeId id, String newName) {
var make = getById(id);
make.rename(newName);
return makeRepository.save(make);
}
}MakeService method · java · L14-L16 (3 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public MakeService(MakeRepository makeRepository) {
this.makeRepository = makeRepository;
}Repobility (the analyzer behind this table) · https://repobility.com
create method · java · L18-L22 (5 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public Make create(String name, String country) {
if (makeRepository.existsByName(name))
throw new IllegalStateException("Make already exists: " + name);
return makeRepository.save(Make.create(name, country));
}getById method · java · L24-L27 (4 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public Make getById(MakeId id) {
return makeRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Make not found: " + id.value()));
}getBySlug method · java · L29-L32 (4 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public Make getBySlug(String slug) {
return makeRepository.findBySlug(slug)
.orElseThrow(() -> new EntityNotFoundException("Make not found: " + slug));
}