PTiffRenditionAdapterFactory.java 1.7 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.cq.dam.dm.process.api.PTiffRendition
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.api.adapter.AdapterFactory
 *  org.apache.sling.api.resource.Resource
 */
package com.adobe.cq.dam.dm.process.image;

import com.adobe.cq.dam.dm.process.api.PTiffRendition;
import com.adobe.cq.dam.dm.process.image.PTiffRenditionImpl;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.adapter.AdapterFactory;
import org.apache.sling.api.resource.Resource;

@Component
@Service(value={AdapterFactory.class})
public class PTiffRenditionAdapterFactory
implements AdapterFactory {
    private static final Class<PTiffRendition> PTIFF_RENDITION_CLASS = PTiffRendition.class;
    @Property(name="adapters")
    public static final String[] ADAPTER_CLASSES = new String[]{PTIFF_RENDITION_CLASS.getName()};
    @Property(name="adaptables")
    public static final String[] ADAPTABLE_CLASSES = new String[]{Resource.class.getName()};

    public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
        if (adaptable instanceof Resource) {
            return this.getAdapter((Resource)adaptable, type);
        }
        return null;
    }

    private <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
        if (type == PTIFF_RENDITION_CLASS) {
            return (AdapterType)PTiffRenditionImpl.getPTiffRendition(resource);
        }
        return null;
    }
}