The Full Guide to ANNOTATIONS In Kotlin

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 43

  • @OlafAchthoven
    @OlafAchthoven Рік тому +8

    Nice video! The Authenticated annotation is really useful. In the birthdate example, the code is looping all fields, and then all annotations, but in the innerloop it is checking one specific annotation. This means that it will check the annotation multiple times if you have multiple annotations. The loop over the annotations is not needed.

  • @varunguptavarun
    @varunguptavarun Рік тому +1

    I was looking forward for a detailed video on annotations. I haven't even watched it yet but already commenting. Thanks for it anyway.

  • @robchr
    @robchr Рік тому +8

    Annotations are really powerful but sometimes there are prettier ways with Kotlin.
    For example, you could have used a value class to achieve the same thing without throwing runtime exceptions. Having a value class with a private constructor and a factory companion method that returns either the inline class instance or null if the value does not match the constraint. The kotlin type checker can then ensure that the constraint only has to be checked once during construction and doesn't require having the value boxed when passed as a parameter.

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      Can you give us a Reference to your solution so we can contrast and compare your proposed technique?

    • @robchr
      @robchr Рік тому

      ​@@ChrisAthanas I would but youtube comments don't allow linking to other sites.

    • @robchr
      @robchr Рік тому

      @@ChrisAthanas zirman/7d68ee7fa04766b53d2d0e37c6e0b144

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      @@robchr very interesting, thanks for posting!

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      I left a comment on the gist

  • @dorsolomon8151
    @dorsolomon8151 Рік тому +7

    It would be cool to see Annotations with annotations proccessing / KAPT / KCP

  • @codebidhya
    @codebidhya Рік тому +15

    Is there a way to write Annotation logic in the annotation class itself? You added the logic check I the init{} at first. Instead of that checks for each class I create. Cannot I add the logic in Annotation class itself? BTW enjoyed the content much!

    • @ChrisAthanas
      @ChrisAthanas Рік тому +2

      I made an extension function for Any and I call it from unit block to run the annotation validation code instead of within the data class unit block
      I have it on my git hub. Realityexpander

    • @aabhishek4911
      @aabhishek4911 Рік тому +9

      You have to write an annotation processor for that , the way annotations have been used in this video is very rudimentary and not viable

    • @noahsragow2892
      @noahsragow2892 Рік тому +2

      Look up Kotlin Symbol Processor

  • @hosenalzuhile3019
    @hosenalzuhile3019 Рік тому +2

    thank you very much for your perfect examples and explanations .. can you make a video on processing these annotations using Processor

  • @jitendrarathore7331
    @jitendrarathore7331 Рік тому +1

    I have some questions, please tell me what is best practices for these question.
    1. How to pass token dynamically for retrofit using share prefence and hilt.

  • @chndraja
    @chndraja Рік тому +2

    Hi Philipp , Thank you for the content on your channel, this helped me a lot.👍👍👍 can you make video on reflection and how it works.

  • @nyanziashraf6983
    @nyanziashraf6983 Рік тому +1

    Hey Philipp can you please make a video about SearchableActivity. The Google docs are shallow in explanation.

  • @royss7656
    @royss7656 Рік тому +1

    Awsome video, how your logging interceptor returns formated json instead of plain text json ?

  • @dewetvanrooyen8458
    @dewetvanrooyen8458 8 місяців тому

    So complex , wow . Okay keep learning then. Thanks for posting.

  • @mehdiparsaei1867
    @mehdiparsaei1867 Рік тому

    Perfect as always. Do you have any videos about KSP?

  • @bhagavanreddy104
    @bhagavanreddy104 Рік тому

    Thanks Philipp

  • @theredd1703
    @theredd1703 6 місяців тому

    Thanks!

  • @a_human_on_earth
    @a_human_on_earth 7 місяців тому

    Nice video! But this is kinda tough I think.. Like we need to find out or search the class.. like if we have a nested data class then it is bit difficult for filed annotation right..! Anyway nice.

  • @jackli1924
    @jackli1924 Рік тому

    nice video!you always teach and explain technology so concise and clearly,thanks a lot!

  • @atulkumar-bb7vi
    @atulkumar-bb7vi Рік тому

    Nice explanation... Thanks!

  • @samadMahmoodi
    @samadMahmoodi Рік тому

    thanks,
    what is your androidstudio theme?

  • @flowzk921
    @flowzk921 Рік тому

    Great Video!

  • @forest__fires
    @forest__fires Рік тому +1

    HI Philip i have a one question
    I/Choreographer: Skipped 60 frames! The application may be doing too much work on its main thread. Why that is printing... How to manage with threads and CoroutineScope in real time sample. please.

    • @ChrisAthanas
      @ChrisAthanas Рік тому +1

      Are you running in debug mode? Try running without debug and see if the messages still appear

    • @forest__fires
      @forest__fires Рік тому

      @@ChrisAthanas its appear in normal.

  • @djfahed3002
    @djfahed3002 Рік тому +1

    Well, the way birthDay field is checked is very ugly and I would never use it like this, it is not useful at all. The useful way I think would be that the annotation class itself doing the check, and this check would be applicable to any other field from other classes, not just the User class. But thanks for the video any way.

    • @barracuda7361
      @barracuda7361 8 місяців тому

      i thought that's how annotation works, but after watch this video i realized that annotation is just... marker? i think.

  • @schnaps1981
    @schnaps1981 Рік тому

    awesome!

  • @Leandro-zo4kp
    @Leandro-zo4kp Рік тому

    Nice !! tks!! S2

  • @bhuvaneshwaranm7290
    @bhuvaneshwaranm7290 Рік тому

    Thanks

  • @forest__fires
    @forest__fires Рік тому +2

    Currently Im asking my doubts to CharGpt Ai.. Its much more efficiently answered.

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      Knowing what to ask and what the answer means will become the new skill set
      Until the skill set is completely subsumed

    • @excalibur8147
      @excalibur8147 Рік тому

      @@ChrisAthanas Knowing what to ask is way easier than knowing how to search for info.

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      @@excalibur8147 I would.say all skills are needed in the player vs player new universe

  • @aviator1472
    @aviator1472 Рік тому +2

    I haven't understanded anything from this video.