@@ -56,6 +56,7 @@ Implicit has the following built-in annotations:
5656| Max | Target value must be greater equals the configured value |
5757| NotNull | Target must not be null |
5858| NotBlank | Target must not be blank |
59+ | NotEmpty | Target (string or collection) must not be empty |
5960| ContentNotNull | Target content (map/collection entries) must not be null |
6061| Between | Target value must be between the min and max value |
6162| Pattern | Target value must match the regex pattern |
@@ -143,7 +144,37 @@ interface Entity {
143144}
144145````
145146
147+ ## GenericType
148+ The @GenericType annotation can be used on methods to let implicit-engine know the type of object that is contained in a collection.
146149
150+
151+ ````
152+ interface EntityA {
153+ fun getContentList(): List<EntityB>
154+ @GenericType(EntityB::class)
155+ fun setContentList(content: List<EntityB>)
156+ }
157+
158+ interface EntityB {
159+ fun getPartitionKey(): String
160+ fun setPartitionKey(str: String)
161+ }
162+
163+ ````
164+ ** Use case:** Object instantiation from a Map, where there are fields with collections of nested objects
165+ e.g.
166+
167+ ````
168+ ....
169+ fun instantiateEntityA(){
170+ val factory = Implicit { "${this.javaClass.name.toLowerCase()}.${it.simpleName}" }
171+ val function = factory.getFunction(IPojoAlpha::class.java)
172+ val instance = function.apply(mapOf(
173+ "partitionKey" to "abc",
174+ "contentSet" to arrayOf(mapOf("partitionKey" to "ABC"), mapOf("partitionKey" to "DEF"))
175+ ))
176+ }
177+ ````
147178## Development
148179
149180### Release
0 commit comments