Assembler

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Assembler(val structure: String = "")

The Assembler annotation is useful to indicate those methods used to assemble anything such payloads of the requests, queries of the requests, etc. For example

class CarsRequester : Requester() {

   fun addCar(
     // car data
   ) {
      val payload = assembleCarPayload()
      // use payload
   }

   @Assembler
   private assembleCarPayload() : JsonObject {
     // return the assembled payload
   }

   fun addTyres(
     // car data
   ) {
      val payload = assembleCarPayload()
      // use payload
   }

   @Assembler(
     structure = "{
         "model" = "model",
         "size" = "size"
     }"
   )
   private assembleTyresPayload() : JsonObject {
     // return the assembled payload
   }


}

Author

N7ghtm4r3 - Tecknobit

Since

1.0.7

Properties

Link copied to clipboard

The structure of the item returned by the method annotated as @Assembler