Is it possible to extend org.springframework.social.facebook.api.impl.*Template class(es)?

179 views Asked by At

Although the current version (1.0.3) of Spring Social Facebook provides operations for me to start with, there's still a few other Graph API calls which are not implemented; such as getting the albums from a fan page, and it just so happens to be a crucial part of the project I'm working on.

I want to add methods to org.springframework.social.facebook.api.Page class which in fact make the not-yet-implemented Graph API calls. After looking up the source codes, I've figured out the magic actually happens in org.springframework.social.facebook.api.impl.PageTemplate class. As the principle of not reinventing the wheel, I'd like to write a new class and I plan on extending the PageTemplate class, but it won't: the Code Completion feature of the IDE shows up only FacebookTemplate for me to extend. Somehow my instinct tells me it ain't there. According to what I've observed from Github, Maven (tree expanded), PageTemplate class does exist alrite.

Is there any reason why I can't extend it, or better/smarter/possible approaches, perhaps!?

1

There are 1 answers

1
Bart On

org.springframework.social.facebook.api.impl.PageTemplate is not a final class so it can be extended without a problem.

Your inability to find the class suggests you're looking at the wrong dependency. Have a look at spring-social-facebook

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-facebook</artifactId>
    <version>1.0.3.RELEASE</version>
</dependency>

The PageTemplate class on GitHub