简体   繁体   中英

Eclipse formatter: how do I format arrays in annotations

I'm using Hibernate Validation (JSR 303) and I'm trying to tame the Eclipse formatter to have nested annotations on seperate lines. Example:

    @DefinedParametersMatchesResultPresence.List( {
    @DefinedParametersMatchesResultPresence( measurement = Measurement.penetrationLength ),
    @DefinedParametersMatchesResultPresence( measurement = Measurement.coneResistance ), @DefinedParametersMatchesResultPresence( measurement = Measurement.depth ),
    @DefinedParametersMatchesResultPresence( measurement = Measurement.electricalConductivity ),

} )

However.. I can't get the annotations in the DefinedParametersMatchesResultPresence.List on a new line when running format. Additionally, the formatter does not comply to my max line length and wrap to a new line.

I'm using:

Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600

Although the formatting concerns annotations, the array formatting also applies. After setting array formatting correctly it works as expected.

Next: its also possible to use the @Repeatable annotation when using your own annotations which lead to a nicer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM