private TwitterFactory factory;
@SuppressWarnings("unchecked")
@Override
public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
TwitterClient client = null;
if (adaptable instanceof Page) {
client = createTwitterClient((Page) adaptable);
} else if (adaptable instanceof com.day.cq.wcm.webservicesupport.Configuration) {
client = createTwitterClient((com.day.cq.wcm.webservicesupport.Configuration) adaptable);
}
if (client != null) {
if (type == TwitterClient.class) {
return (AdapterType) client;
} else if (type == Twitter.class) {
return (AdapterType) client.getTwitter();
}
}
return null;
}