All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.kinesisvideo.parser.mkv.visitors.CompositeMkvElementVisitor Maven / Gradle / Ivy

// Generated by delombok at Mon Mar 05 19:46:46 UTC 2018
/*
Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). 
You may not use this file except in compliance with the License. 
A copy of the License is located at

   http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. 
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
*/
package com.amazonaws.kinesisvideo.parser.mkv.visitors;

import com.amazonaws.kinesisvideo.parser.mkv.MkvDataElement;
import com.amazonaws.kinesisvideo.parser.mkv.MkvElement;
import com.amazonaws.kinesisvideo.parser.mkv.MkvElementVisitException;
import com.amazonaws.kinesisvideo.parser.mkv.MkvElementVisitor;
import com.amazonaws.kinesisvideo.parser.mkv.MkvEndMasterElement;
import com.amazonaws.kinesisvideo.parser.mkv.MkvStartMasterElement;
import java.util.ArrayList;
import java.util.List;

/**
 * Class represents a composite visitor made out of multiple visitors.
 */
public class CompositeMkvElementVisitor extends MkvElementVisitor {
    @SuppressWarnings("all")
    @javax.annotation.Generated("lombok")
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CompositeMkvElementVisitor.class);
    protected final List childVisitors;

    public CompositeMkvElementVisitor(MkvElementVisitor... visitors) {
        childVisitors = new ArrayList<>();
        for (MkvElementVisitor visitor : visitors) {
            childVisitors.add(visitor);
        }
    }

    @Override
    public void visit(MkvStartMasterElement startMasterElement) throws MkvElementVisitException {
        visitAll(startMasterElement);
    }

    @Override
    public void visit(MkvEndMasterElement endMasterElement) throws MkvElementVisitException {
        visitAll(endMasterElement);
    }

    @Override
    public void visit(MkvDataElement dataElement) throws MkvElementVisitException {
        visitAll(dataElement);
    }

    private void visitAll(MkvElement element) throws MkvElementVisitException {
        try {
            for (MkvElementVisitor childVisitor : childVisitors) {
                if (log.isDebugEnabled()) {
                    log.debug("Composite visitor calling {} on element {}", childVisitor.getClass().toString(), element.toString());
                }
                element.accept(childVisitor);
            }
        } catch (MkvElementVisitException e) {
            throw new MkvElementVisitException("Composite Visitor caught exception ", e);
        }
    }

    @java.beans.ConstructorProperties({"childVisitors"})
    @SuppressWarnings("all")
    @javax.annotation.Generated("lombok")
    protected CompositeMkvElementVisitor(final List childVisitors) {
        this.childVisitors = childVisitors;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy