com.adobe.cq.screens.visitor.OfflineResourceHandler Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2019 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
************************************************************************/
package com.adobe.cq.screens.visitor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.function.Predicate;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import aQute.bnd.annotation.ConsumerType;
/**
* The resource handler for the {@link OfflineResourceVisitor} to use for the provided resource types.
*/
@ConsumerType
public interface OfflineResourceHandler {
/**
* The resource types that are handled by the handler.
* @return the handled resource types
*/
@Nonnull
String[] getSupportedResourceTypes();
/**
* Add a predicate that decides whether to accept or not the resource.
*
* @param predicate The predicate to use. The resource is accepted if the predicate returns true
*/
void setCustomPredicate(@Nonnull Predicate predicate);
/**
* Get the predicate that decides whether to accept or not the resource.
* @return the custom predicate
*/
@Nullable
Predicate getCustomPredicate();
/**
* Accept the provided resource, visit and traverse it as needed.
*
* @param resource The resource to accept
*/
void accept(@Nonnull Resource resource);
/**
* Set the visitor to use for the resource
* @param visitor the visitor to use
*/
void setVisitor(@Nonnull OfflineResourceVisitor visitor);
}