Editing an external library

泪湿孤枕 提交于 2021-02-20 04:10:10

问题


I have an external library in the project:

The project uses methods from this library

For me, the classes in this library are read-only

I need to change the method logic from an external library a little bit

What and how should I do?

Maybe I should create new class in project with the same logic? (+ my changes)

Maybe other solutions?


回答1:


If you use Kotlin you could use Extension Function to extend class functionalities with no need to extend it. You use Java you could extend the classes and override or add methods to it. There is no need to copy/paste class to add new functionalities.



来源:https://stackoverflow.com/questions/58396869/editing-an-external-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!