Skip to content

dantheoptimist/mapstruct-spi-protobuf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protobuf accessor naming strategy CircleCI

This naming strategy helps mapstruct generate working mapping code between your domain classes and protobuf classes. Both fullblown Java protobuf and protolite classes suported.

Manual mapping needed for

  • map<k,v>
  • oneof

Usage

Maven

Add the following section to you maven-compiler-plugin plugin configuration:

<annotationProcessorPaths>
	<path>
		<groupId>no.entur.mapstruct.spi</groupId>
		<artifactId>protobuf-spi-impl</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</path>
</annotationProcessorPaths>
<dependencies>
    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${org.mapstruct.version}</version>
    </dependency>
</dependencies>

Complete example:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>

	<configuration>
		<source>1.8</source> 
		<target>1.8</target> 
		<annotationProcessorPaths>
			<path>
        		<groupId>no.entur.mapstruct.spi</groupId>
		        <artifactId>protobuf-spi-impl</artifactId>
		        <version>1.0.0-SNAPSHOT</version>
			</path>
		</annotationProcessorPaths>
	</configuration>
    <dependencies>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
    </dependencies>

</plugin>

Gradle

implementation "org.mapstruct:mapstruct:${mapstructVersion}"
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
annotationProcessor "no.entur.mapstruct.spi:protobuf-spi-impl:1.0.0"

More information:

http://mapstruct.org/documentation/stable/reference/html/index.html#using-spi

About

Protobuf accessor naming strategy for Mapstruct

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%