sdr-mixins

Defines various "mixin" interfaces for exposing Spring Data repository methods in a more granular method

License

License

Categories

Categories

Mixin Application Layer Libs Bytecode Manipulation
GroupId

GroupId

com.sdoctech
ArtifactId

ArtifactId

sdr-mixins
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

sdr-mixins
Defines various "mixin" interfaces for exposing Spring Data repository methods in a more granular method
Project URL

Project URL

https://github.com/SDOCTech/sdr-mixins
Source Code Management

Source Code Management

https://github.com/SDOCTech/sdr-mixins

Download sdr-mixins

How to add to project

<!-- https://jarcasting.com/artifacts/com.sdoctech/sdr-mixins/ -->
<dependency>
    <groupId>com.sdoctech</groupId>
    <artifactId>sdr-mixins</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.sdoctech/sdr-mixins/
implementation 'com.sdoctech:sdr-mixins:1.0'
// https://jarcasting.com/artifacts/com.sdoctech/sdr-mixins/
implementation ("com.sdoctech:sdr-mixins:1.0")
'com.sdoctech:sdr-mixins:jar:1.0'
<dependency org="com.sdoctech" name="sdr-mixins" rev="1.0">
  <artifact name="sdr-mixins" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sdoctech', module='sdr-mixins', version='1.0')
)
libraryDependencies += "com.sdoctech" % "sdr-mixins" % "1.0"
[com.sdoctech/sdr-mixins "1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.springframework.data : spring-data-commons jar 2.0.7.RELEASE

Project Modules

There are no modules declared in this project.

sdr-mixins

The Spring Data Repository "mixins" project provides users with a way to make more granular repositories to use with Spring Data. Normally a user could implement the CrudRepository. However, this approach exposes methods like deleteAll() to the rest of the application.

With the various interfaces users can control which methods are exposed by their repository interface, thus insuring that methods that should not be invoked are never available to be called in the first place.

NOTE: In the end this really is just a preference for me that I really like. I made this available on the off chance that others like it as well. I've personally found spring-data and all of its accompanying modules to be fantastic libraries that help me be very productive.

Installation

To use add the following dependency to your pom

<dependency>
    <groupId>com.sdoctech</groupId>
    <artifactId>sdr-mixins</artifactId>
    <version>1.0</version>
</dependency>

Usage

Suppose that you only want to expose the ability to find an entity by its id and to test for existence of an entity by its id. You would just do the following:

public interface MyNewRepository<MyEntity, Long> extends
    HasFindById<MyEntity, Long>,
    HasExistsById<MyEntity, Long>,
    Repository<MyEntity, Long> {
}
com.sdoctech

SDOC Tech

Versions

Version
1.0