Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Override core class
Hi.
I am working with Liferay 7.1. I want to override one core class: HtmlBBCodeTranslatorImpl
https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/message-boards/message-boards-parser-bbcode/src/main/java/com/liferay/message/boards/parser/bbcode/internal/HtmlBBCodeTranslatorImpl.java
is there any option of doing it without override the entire module and place it in override? Any help you can give me would be very appreciated
Thanks in advance
I am working with Liferay 7.1. I want to override one core class: HtmlBBCodeTranslatorImpl
https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/message-boards/message-boards-parser-bbcode/src/main/java/com/liferay/message/boards/parser/bbcode/internal/HtmlBBCodeTranslatorImpl.java
is there any option of doing it without override the entire module and place it in override? Any help you can give me would be very appreciated
Thanks in advance
Daniel G:
Hi.
I am working with Liferay 7.1. I want to override one core class: HtmlBBCodeTranslatorImpl
https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/message-boards/message-boards-parser-bbcode/src/main/java/com/liferay/message/boards/parser/bbcode/internal/HtmlBBCodeTranslatorImpl.java
is there any option of doing it without override the entire module and place it in override? Any help you can give me would be very appreciated
There might be, but you'll need to stop thinking in terms of "overriding". Looking at the code you link, it's a proper declarative service, and while the "internal" package and the "Impl" class name suggest that it's well locked away, nothing keeps you from implementing another service that does what you need.
I haven't tried it for this particular service, but this and the following chapters in OSGi Basics (free registration / sign in required) might help you to provide such an alternative implementation. Of course, Liferay's implementation might use quite a bit of more internal code that you won't have access to, but that would be the next problem.
Sometimes, module overrides aren't the best maintainable option, sometimes they are. Try both, then judge which solution you expect to be the best maintainable one under the circumstances (code dependencies) that you find.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™