Package com.adobe.granite.comments
Interface CommentManager
The
CommentManager provides facilities to manage (create, get or remove) CommentCollections.
This manager is registered as an OSGi-service and can be obtained via this interface class from the service registry.
The manager produces typed collections. The type-specific collections are produced by CommentingProviders.
The manager binds available factories and uses them to instantiate collections based on the given collection type.-
Method Summary
Modifier and TypeMethodDescription<C extends CommentCollection>
CcreateCollection(Resource target, Class<C> collectionType) Create aCommentCollectionfor the giventarget.<C extends CommentCollection>
CgetCollection(Resource target, Class<C> collectionType) Retrieve aCommentCollectionfor the giventarget.<C extends CommentCollection>
CgetOrCreateCollection(Resource target, Class<C> collectionType) Retrieve or - if none exists - create aCommentCollectionfor the giventarget.
-
Method Details
-
getCollection
Retrieve aCommentCollectionfor the giventarget. The collection is instantiated using the givencollectionType, as provided by the type-specificCommentingProvider.- Type Parameters:
C- A collection type, extendingCommentCollection.- Parameters:
target- TheResourcerepresenting the target for which to retrieve the comment collection.collectionType- The desired type of the collection.- Returns:
- The collection, or
nullif no collection of the requested type is present. - Throws:
CommentException- If noCommentingProvidercould be found for the givencollectionType.IllegalArgumentException- If either target or collectionType is null.
-
getOrCreateCollection
Retrieve or - if none exists - create aCommentCollectionfor the giventarget. The collection is instantiated using the givencollectionType, as provided by the type-specificCommentingProvider.- Type Parameters:
C- A collection type, extendingCommentCollection.- Parameters:
target- TheResourcerepresenting the target for which to create or retrieve the comment collection.collectionType- The desired type of the collection.- Returns:
- The collection.
- Throws:
CommentException- Upon encountering an error during creation of a collection, or if the collection already exists, or if noCommentingProvidercould be found for the givencollectionType.IllegalArgumentException- If either target or collectionType is null.
-
createCollection
Create aCommentCollectionfor the giventarget. The collection is instantiated using the givencollectionType, as provided by the type-specificCommentingProvider.- Type Parameters:
C- A collection type, extendingCommentCollection.- Parameters:
target- TheResourcerepresenting the target for which to create the comment collection.collectionType- The desired type of the collection.- Returns:
- The newly created collection.
- Throws:
CommentException- Upon encountering an error during creation of a collection, or if the collection already exists, or if noCommentingProvidercould be found for the givencollectionType.IllegalArgumentException- If either target or collectionType is null.
-