diff --git a/src/main/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDsl.kt b/src/main/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDsl.kt similarity index 74% rename from src/main/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDsl.kt rename to src/main/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDsl.kt index 343a1cd8..36cd307c 100644 --- a/src/main/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDsl.kt +++ b/src/main/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDsl.kt @@ -18,25 +18,26 @@ package org.springframework.hateoas.mvc import org.springframework.hateoas.Affordance import org.springframework.hateoas.Link -import org.springframework.hateoas.mvc.ControllerLinkBuilder.afford -import org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn +import org.springframework.hateoas.mvc.WebMvcLinkBuilder.afford +import org.springframework.hateoas.mvc.WebMvcLinkBuilder.methodOn /** * Create a new [Link] with additional [Affordance]s. * * @author Roland Kulcsár + * @author Greg Turnquist * @since 1.0 */ -inline infix fun Link.andAffordances(setup: AffordanceBuilderDsl.() -> Unit): Link { +inline infix fun Link.andAffordances(setup: WebMvcAffordanceBuilderDsl.() -> Unit): Link { - val builder = AffordanceBuilderDsl() + val builder = WebMvcAffordanceBuilderDsl() builder.setup() return andAffordances(builder.affordances) } /** - * Extract a [Link] from the [ControllerLinkBuilder] and look up the related [Affordance]. Should + * Extract a [Link] from the [WebMvcLinkBuilder] and look up the related [Affordance]. Should * only be one. * * @author Roland Kulcsár @@ -50,7 +51,7 @@ inline fun afford(func: C.() -> Unit): Affordance = afford(methodOn( * @author Roland Kulcsár * @since 1.0 */ -open class AffordanceBuilderDsl(val affordances: MutableList = mutableListOf()) { +open class WebMvcAffordanceBuilderDsl(val affordances: MutableList = mutableListOf()) { inline fun afford(func: C.() -> Any) { diff --git a/src/main/kotlin/org/springframework/hateoas/mvc/LinkBuilderDsl.kt b/src/main/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDsl.kt similarity index 64% rename from src/main/kotlin/org/springframework/hateoas/mvc/LinkBuilderDsl.kt rename to src/main/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDsl.kt index 02738339..af3e5dc6 100644 --- a/src/main/kotlin/org/springframework/hateoas/mvc/LinkBuilderDsl.kt +++ b/src/main/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDsl.kt @@ -19,19 +19,20 @@ package org.springframework.hateoas.mvc import org.springframework.hateoas.Link import org.springframework.hateoas.LinkRelation import org.springframework.hateoas.ResourceSupport -import org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo -import org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn +import org.springframework.hateoas.mvc.WebMvcLinkBuilder.linkTo +import org.springframework.hateoas.mvc.WebMvcLinkBuilder.methodOn import kotlin.reflect.KClass /** - * Create a [ControllerLinkBuilder] pointing to a [func] method. + * Create a [WebMvcLinkBuilder] pointing to a [func] method. * * @author Roland Kulcsár * @author Oliver Drotbohm + * @author Greg Turnquist * @since 1.0 */ -inline fun linkTo(func: C.() -> Unit): ControllerLinkBuilder = linkTo(methodOn(C::class.java).apply(func)) +inline fun linkTo(func: C.() -> Unit): WebMvcLinkBuilder = linkTo(methodOn(C::class.java).apply(func)) /** * Create a [Link] with the given [rel]. @@ -39,8 +40,8 @@ inline fun linkTo(func: C.() -> Unit): ControllerLinkBuilder = linkT * @author Roland Kulcsár * @since 1.0 */ -infix fun ControllerLinkBuilder.withRel(rel: LinkRelation): Link = withRel(rel) -infix fun ControllerLinkBuilder.withRel(rel: String): Link = withRel(rel) +infix fun WebMvcLinkBuilder.withRel(rel: LinkRelation): Link = withRel(rel) +infix fun WebMvcLinkBuilder.withRel(rel: String): Link = withRel(rel) /** * Add [links] to the [R] resource. @@ -48,9 +49,9 @@ infix fun ControllerLinkBuilder.withRel(rel: String): Link = withRel(rel) * @author Roland Kulcsár * @since 1.0 */ -fun R.add(controller: Class, links: LinkBuilderDsl.(R) -> Unit): R { +fun R.add(controller: Class, links: WebMvcLinkBuilderDsl.(R) -> Unit): R { - val builder = LinkBuilderDsl(controller, this) + val builder = WebMvcLinkBuilderDsl(controller, this) builder.links(this) return this @@ -62,7 +63,7 @@ fun R.add(controller: Class, links: LinkBuilderDsl R.add(controller: KClass, links: LinkBuilderDsl.(R) -> Unit): R { +fun R.add(controller: KClass, links: WebMvcLinkBuilderDsl.(R) -> Unit): R { return add(controller.java, links) } @@ -72,24 +73,24 @@ fun R.add(controller: KClass, links: LinkBuild * @author Roland Kulcsár * @since 1.0 */ -open class LinkBuilderDsl(val controller: Class, val resource: R) { +open class WebMvcLinkBuilderDsl(val controller: Class, val resource: R) { /** - * Create a [ControllerLinkBuilder] pointing to [func] method. + * Create a [WebMvcLinkBuilder] pointing to [func] method. */ - fun linkTo(func: C.() -> R): ControllerLinkBuilder = linkTo(methodOn(controller).run(func)) + fun linkTo(func: C.() -> R): WebMvcLinkBuilder = linkTo(methodOn(controller).run(func)) /** * Add a link with the given [rel] to the [resource]. */ - infix fun ControllerLinkBuilder.withRel(rel: String): Link { + infix fun WebMvcLinkBuilder.withRel(rel: String): Link { return this withRel(LinkRelation.of(rel)) } /** * Add a link with the given [rel] to the [resource]. */ - infix fun ControllerLinkBuilder.withRel(rel: LinkRelation): Link { + infix fun WebMvcLinkBuilder.withRel(rel: LinkRelation): Link { val link = withRel(rel) resource.add(link) diff --git a/src/test/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDslUnitTest.kt b/src/test/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDslUnitTest.kt similarity index 96% rename from src/test/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDslUnitTest.kt rename to src/test/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDslUnitTest.kt index 983cd2e8..d6e1e503 100644 --- a/src/test/kotlin/org/springframework/hateoas/mvc/AffordanceBuilderDslUnitTest.kt +++ b/src/test/kotlin/org/springframework/hateoas/mvc/WebMvcAffordanceBuilderDslUnitTest.kt @@ -23,11 +23,12 @@ import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* /** - * Unit tests for [LinkBuilderDsl] and [AffordanceBuilderDsl]. + * Unit tests for [WebMvcLinkBuilderDsl] and [WebMvcAffordanceBuilderDsl]. * * @author Roland Kulcsár + * @author Greg Turnquist */ -class AffordanceBuilderDslUnitTest : TestUtils() { +class WebMvcAffordanceBuilderDslUnitTest : TestUtils() { /** * @see #715 diff --git a/src/test/kotlin/org/springframework/hateoas/mvc/LinkBuilderDslUnitTest.kt b/src/test/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDslUnitTest.kt similarity index 95% rename from src/test/kotlin/org/springframework/hateoas/mvc/LinkBuilderDslUnitTest.kt rename to src/test/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDslUnitTest.kt index 78109c8c..240a5d25 100644 --- a/src/test/kotlin/org/springframework/hateoas/mvc/LinkBuilderDslUnitTest.kt +++ b/src/test/kotlin/org/springframework/hateoas/mvc/WebMvcLinkBuilderDslUnitTest.kt @@ -22,11 +22,12 @@ import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* /** - * Unit tests for [LinkBuilderDsl] and [AffordanceBuilderDsl]. + * Unit tests for [WebMvcLinkBuilderDsl] and [WebMvcAffordanceBuilderDsl]. * * @author Roland Kulcsár + * @author Greg Turnquist */ -class LinkBuilderDslUnitTest : TestUtils() { +class WebMvcLinkBuilderDslUnitTest : TestUtils() { private val REL_PRODUCTS = "products"