Well what is the benefit of generating Java gadget with ysoserial? It's so fast, easy and convenient. But at some point you might need to customize your gadget as some application (i.e in CTF) might block some classes in deserialization process, and that's why you need to implement the gadget your self in order to tweak it to suit your need.
This is some of java gadget implementation, this repo is my storage so that my shit don't get swiped away everytime i reinstall a new OS, also if you find the implementation useful in your learning journey, fork it and use, try to understand the raw implementation of the gadget without ysoserial.