com.qcloud.cos.model.SelectObjectContentEventVisitor Maven / Gradle / Ivy
/*
* Copyright 2010-2019 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.
* According to cos feature, we modify some class,comment, field name, etc.
*/
package com.qcloud.cos.model;
import com.qcloud.cos.model.SelectObjectContentEvent.ContinuationEvent;
import com.qcloud.cos.model.SelectObjectContentEvent.EndEvent;
import com.qcloud.cos.model.SelectObjectContentEvent.ProgressEvent;
import com.qcloud.cos.model.SelectObjectContentEvent.StatsEvent;
import com.qcloud.cos.model.SelectObjectContentEvent.RecordsEvent;
/**
* A method for applying logic to an unknown type of {@link SelectObjectContentEvent} without needing to perform "instanceof"
* checks and casting.
*
* A visitor can be applied to an entire event stream with
* {@link SelectObjectContentEventStream#visitAllEvents(SelectObjectContentEventVisitor)} or to an individual event with
* {@link SelectObjectContentEvent#visit(SelectObjectContentEventVisitor)}.
*/
public abstract class SelectObjectContentEventVisitor {
/**
* Invoked when a {@link RecordsEvent} is encountered. If this is not overridden, the event will be given to
* {@link #visitDefault(SelectObjectContentEvent)}.
*/
public void visit(RecordsEvent event) {
visitDefault(event);
}
/**
* Invoked when a {@link ContinuationEvent} is encountered. If this is not overridden, the event will be given to
* {@link #visitDefault(SelectObjectContentEvent)}.
*/
public void visit(ContinuationEvent event) {
visitDefault(event);
}
/**
* Invoked when a {@link ProgressEvent} is encountered. If this is not overridden, the event will be given to
* {@link #visitDefault(SelectObjectContentEvent)}.
*/
public void visit(ProgressEvent event) {
visitDefault(event);
}
/**
* Invoked when a {@link StatsEvent} is encountered. If this is not overridden, the event will be given to
* {@link #visitDefault(SelectObjectContentEvent)}.
*/
public void visit(StatsEvent event) {
visitDefault(event);
}
/**
* Invoked when a {@link EndEvent} is encountered. If this is not overridden, the event will be given to
* {@link #visitDefault(SelectObjectContentEvent)}.
*/
public void visit(EndEvent event) {
visitDefault(event);
}
/**
* A required "else" or "default" block, invoked with no other more-specific "visit" method is appropriate. This is
* invoked under two circumstances:
*
* - The event encountered is newer than the current version of the SDK, so no other more-specific "visit" method
* could be called. In this case, the provided event will be a generic {@link SelectObjectContentEvent}. These events
* can be processed by upgrading the SDK.
* - The event is known by the SDK, but the "visit" was not overridden above. In this case, the provided event will
* be a specific type of {@link SelectObjectContentEvent}.
*
*
* @param selectEvent The event that was not handled by a more-specific "visit" method.
*/
public void visitDefault(SelectObjectContentEvent selectEvent) {
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy