SimpleContext.java 1.7 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.dam.api.Context
 *  com.day.cq.dam.api.ProcessorException
 */
package com.day.cq.dam.commons.handler;

import com.day.cq.dam.api.Context;
import com.day.cq.dam.api.ProcessorException;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class SimpleContext
implements Context {
    private List<InputStream> metas;
    private List<BufferedImage> thumbnails;
    private List<ProcessorException> exceptions;

    public InputStream[] getMetadata() {
        if (this.metas != null) {
            return this.metas.toArray(new InputStream[0]);
        }
        return null;
    }

    public BufferedImage[] getThumbnails() {
        if (this.thumbnails != null) {
            return this.thumbnails.toArray(new BufferedImage[0]);
        }
        return null;
    }

    public ProcessorException[] getExceptions() {
        if (this.exceptions != null) {
            return this.exceptions.toArray((T[])new ProcessorException[0]);
        }
        return null;
    }

    public void addException(ProcessorException e) {
        if (this.exceptions == null) {
            this.exceptions = new ArrayList<ProcessorException>();
        }
        this.exceptions.add(e);
    }

    public void addMetadata(InputStream meta) {
        if (this.metas == null) {
            this.metas = new ArrayList<InputStream>();
        }
        this.metas.add(meta);
    }

    public void addThumbnail(BufferedImage image) {
        if (this.thumbnails == null) {
            this.thumbnails = new ArrayList<BufferedImage>();
        }
        this.thumbnails.add(image);
    }
}