jhipster / jhipster/prettier-java
Format record properties equivalent to class fields
- Vorherrschende Sprache
- Java
- Sterne
- 1.2k
- Forks
- 120
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 27
Beschreibung
**Prettier-Java 1.6.0**
```sh
--print-width 80
```
**Input:**
```java
public record PolicyDto(
@NotNull
@Pattern(regexp = "\\d{10}")
String policyNumber,
@NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
**Output:**
```java
public record PolicyDto(
@NotNull @Pattern(regexp = "\\d{10}") String policyNumber,
@NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
**Expected behavior:**
```java
public record PolicyDto(
@NotNull
@Pattern(regexp = "\\d{10}")
String policyNumber,
@NotEmpty
List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
Format document properties equivalent to class fields. For this, each annotation needs to be put on a separate line (regardless of whether the print-width is exceeded).
Beitragsleitfaden
Rechercherichtung
No files, tests, or entry points are named. Reproduce the issue with the provided Java record and Prettier-Java 1.6.0 configuration, then compare record-property formatting with class-field formatting; done means each record annotation is on its own line regardless of print width.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 38/100