@@ -82,7 +82,7 @@ class Entity<P extends Property> {
8282 return defaultSort
8383 }
8484
85- Entity setSort (Object defaultSort ) {
85+ Entity<P> setSort (Object defaultSort ) {
8686 this . defaultSort = defaultSort
8787 return this
8888 }
@@ -99,7 +99,7 @@ class Entity<P extends Property> {
9999 * @param name
100100 * @return
101101 */
102- Entity datasource (String name ) {
102+ Entity<P> datasource (String name ) {
103103 this . datasources = [name]
104104 return this
105105 }
@@ -111,7 +111,7 @@ class Entity<P extends Property> {
111111 * @param name
112112 * @return
113113 */
114- Entity connection (String name ) {
114+ Entity<P> connection (String name ) {
115115 this . datasources = [name]
116116 return this
117117 }
@@ -123,7 +123,7 @@ class Entity<P extends Property> {
123123 * @param name
124124 * @return
125125 */
126- Entity connections (String ...names ) {
126+ Entity<P> connections (String ...names ) {
127127 connections(Arrays . asList(names))
128128 return this
129129 }
@@ -134,7 +134,7 @@ class Entity<P extends Property> {
134134 * @param name
135135 * @return
136136 */
137- Entity connections (List<String > names ) {
137+ Entity<P> connections (List<String > names ) {
138138 if (names != null && names. size() > 0 ) {
139139 this . datasources = names
140140 }
@@ -172,7 +172,7 @@ class Entity<P extends Property> {
172172 * @param identityConfig The id config
173173 * @return This mapping
174174 */
175- Entity<P> id (@DelegatesTo (Property ) Closure identityConfig ) {
175+ Entity<P> id (@DelegatesTo (type = ' P ' ) Closure identityConfig ) {
176176 Property . configureExisting(
177177 getOrInitializePropertyConfig(GormProperties . IDENTITY ),
178178 identityConfig
@@ -185,7 +185,7 @@ class Entity<P extends Property> {
185185 *
186186 * @param isVersioned True if a version property should be configured
187187 */
188- Entity version (@DelegatesTo (Property ) Closure versionConfig ) {
188+ Entity<P> version (@DelegatesTo (type = ' P ' ) Closure versionConfig ) {
189189 P pc = getOrInitializePropertyConfig(GormProperties . VERSION )
190190 Property . configureExisting(pc, versionConfig)
191191 return this
@@ -196,7 +196,7 @@ class Entity<P extends Property> {
196196 *
197197 * @param isVersioned True if a version property should be configured
198198 */
199- Entity version (Map versionConfig ) {
199+ Entity<P> version (Map versionConfig ) {
200200 P pc = getOrInitializePropertyConfig(GormProperties . VERSION )
201201 Property . configureExisting(pc, versionConfig)
202202 return this
@@ -207,7 +207,7 @@ class Entity<P extends Property> {
207207 *
208208 * @param tenantIdProperty The tenant id property
209209 */
210- Entity tenantId (String tenantIdProperty ) {
210+ Entity<P> tenantId (String tenantIdProperty ) {
211211 P pc = getOrInitializePropertyConfig(GormProperties . TENANT_IDENTITY )
212212 pc. name = tenantIdProperty
213213 return this
@@ -218,7 +218,7 @@ class Entity<P extends Property> {
218218 * @param propertyConfig The property config
219219 * @return This mapping
220220 */
221- Entity property (String name , @DelegatesTo (Property ) Closure propertyConfig ) {
221+ Entity<P> property (String name , @DelegatesTo (type = ' P ' ) Closure propertyConfig ) {
222222 P pc = getOrInitializePropertyConfig(name)
223223 Property . configureExisting(pc, propertyConfig)
224224 return this
@@ -230,7 +230,7 @@ class Entity<P extends Property> {
230230 * @param propertyConfig The property config
231231 * @return This mapping
232232 */
233- Entity property (String name , Map propertyConfig ) {
233+ Entity<P> property (String name , Map propertyConfig ) {
234234 P pc = getOrInitializePropertyConfig(name)
235235 Property . configureExisting(pc, propertyConfig)
236236 return this
@@ -242,7 +242,7 @@ class Entity<P extends Property> {
242242 * @param propertyConfig The property config
243243 * @return This mapping
244244 */
245- P property (@DelegatesTo (Property ) Closure propertyConfig ) {
245+ P property (@DelegatesTo (type = ' P ' ) Closure propertyConfig ) {
246246 if (propertyConfigs. containsKey(' *' )) {
247247 P cloned = cloneGlobalConstraint()
248248 return Property . configureExisting(cloned, propertyConfig)
@@ -277,7 +277,7 @@ class Entity<P extends Property> {
277277 * @param config The configuration
278278 * @return The new instance
279279 */
280- static <T extends Entity > T configureExisting (T mapping , @DelegatesTo (Entity ) Closure config ) {
280+ static <T extends Entity > T configureExisting (@DelegatesTo.Target T mapping , @DelegatesTo (genericTypeIndex = 0 ) Closure config ) {
281281 config. setDelegate(mapping)
282282 config. setResolveStrategy(Closure . DELEGATE_ONLY )
283283 config. call()
0 commit comments