@@ -19,38 +19,39 @@ package org.springframework.hateoas.mvc
19
19
import org.springframework.hateoas.Link
20
20
import org.springframework.hateoas.LinkRelation
21
21
import org.springframework.hateoas.ResourceSupport
22
- import org.springframework.hateoas.mvc.ControllerLinkBuilder .linkTo
23
- import org.springframework.hateoas.mvc.ControllerLinkBuilder .methodOn
22
+ import org.springframework.hateoas.mvc.WebMvcLinkBuilder .linkTo
23
+ import org.springframework.hateoas.mvc.WebMvcLinkBuilder .methodOn
24
24
25
25
import kotlin.reflect.KClass
26
26
27
27
/* *
28
- * Create a [ControllerLinkBuilder ] pointing to a [func] method.
28
+ * Create a [WebMvcLinkBuilder ] pointing to a [func] method.
29
29
*
30
30
* @author Roland Kulcsár
31
31
* @author Oliver Drotbohm
32
+ * @author Greg Turnquist
32
33
* @since 1.0
33
34
*/
34
- inline fun <reified C > linkTo (func : C .() -> Unit ): ControllerLinkBuilder = linkTo(methodOn(C ::class .java).apply (func))
35
+ inline fun <reified C > linkTo (func : C .() -> Unit ): WebMvcLinkBuilder = linkTo(methodOn(C ::class .java).apply (func))
35
36
36
37
/* *
37
38
* Create a [Link] with the given [rel].
38
39
*
39
40
* @author Roland Kulcsár
40
41
* @since 1.0
41
42
*/
42
- infix fun ControllerLinkBuilder .withRel (rel : LinkRelation ): Link = withRel(rel)
43
- infix fun ControllerLinkBuilder .withRel (rel : String ): Link = withRel(rel)
43
+ infix fun WebMvcLinkBuilder .withRel (rel : LinkRelation ): Link = withRel(rel)
44
+ infix fun WebMvcLinkBuilder .withRel (rel : String ): Link = withRel(rel)
44
45
45
46
/* *
46
47
* Add [links] to the [R] resource.
47
48
*
48
49
* @author Roland Kulcsár
49
50
* @since 1.0
50
51
*/
51
- fun <C , R : ResourceSupport > R.add (controller : Class <C >, links : LinkBuilderDsl <C , R >.(R ) -> Unit ): R {
52
+ fun <C , R : ResourceSupport > R.add (controller : Class <C >, links : WebMvcLinkBuilderDsl <C , R >.(R ) -> Unit ): R {
52
53
53
- val builder = LinkBuilderDsl (controller, this )
54
+ val builder = WebMvcLinkBuilderDsl (controller, this )
54
55
builder.links(this )
55
56
56
57
return this
@@ -62,7 +63,7 @@ fun <C, R : ResourceSupport> R.add(controller: Class<C>, links: LinkBuilderDsl<C
62
63
* @author Roland Kulcsár
63
64
* @since 1.0
64
65
*/
65
- fun <C : Any , R : ResourceSupport > R.add (controller : KClass <C >, links : LinkBuilderDsl <C , R >.(R ) -> Unit ): R {
66
+ fun <C : Any , R : ResourceSupport > R.add (controller : KClass <C >, links : WebMvcLinkBuilderDsl <C , R >.(R ) -> Unit ): R {
66
67
return add(controller.java, links)
67
68
}
68
69
@@ -72,24 +73,24 @@ fun <C : Any, R : ResourceSupport> R.add(controller: KClass<C>, links: LinkBuild
72
73
* @author Roland Kulcsár
73
74
* @since 1.0
74
75
*/
75
- open class LinkBuilderDsl <C , R : ResourceSupport >(val controller : Class <C >, val resource : R ) {
76
+ open class WebMvcLinkBuilderDsl <C , R : ResourceSupport >(val controller : Class <C >, val resource : R ) {
76
77
77
78
/* *
78
- * Create a [ControllerLinkBuilder ] pointing to [func] method.
79
+ * Create a [WebMvcLinkBuilder ] pointing to [func] method.
79
80
*/
80
- fun <R > linkTo (func : C .() -> R ): ControllerLinkBuilder = linkTo(methodOn(controller).run (func))
81
+ fun <R > linkTo (func : C .() -> R ): WebMvcLinkBuilder = linkTo(methodOn(controller).run (func))
81
82
82
83
/* *
83
84
* Add a link with the given [rel] to the [resource].
84
85
*/
85
- infix fun ControllerLinkBuilder .withRel (rel : String ): Link {
86
+ infix fun WebMvcLinkBuilder .withRel (rel : String ): Link {
86
87
return this withRel(LinkRelation .of(rel))
87
88
}
88
89
89
90
/* *
90
91
* Add a link with the given [rel] to the [resource].
91
92
*/
92
- infix fun ControllerLinkBuilder .withRel (rel : LinkRelation ): Link {
93
+ infix fun WebMvcLinkBuilder .withRel (rel : LinkRelation ): Link {
93
94
94
95
val link = withRel(rel)
95
96
resource.add(link)
0 commit comments