From 80b7813cc0ba9b84db1e7cbee834234443804be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Sat, 7 Sep 2024 20:47:03 +0200 Subject: [PATCH] Expose no-op sink --- .../doxia/sink/impl/NoOpSinkFactory.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/NoOpSinkFactory.java diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/NoOpSinkFactory.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/NoOpSinkFactory.java new file mode 100644 index 000000000..1cd54b04b --- /dev/null +++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/NoOpSinkFactory.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License 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 org.apache.maven.doxia.sink.impl; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.File; +import java.io.OutputStream; + +import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.doxia.sink.SinkFactory; + +/** + * NoOp implementation of the Sink factory. + */ +@Singleton +@Named("noop") +public final class NoOpSinkFactory implements SinkFactory { + Sink createSink() { + return new SinkAdapter(); + } + + @Override + public Sink createSink(File ignoredOutputDir, String ignoredOutputName) { + return createSink(); + } + + @Override + public Sink createSink(File ignoredOutputDir, String ignoredOutputName, String ignoredEncoding) { + return createSink(); + } + + @Override + public Sink createSink(OutputStream ignoredOut) { + return createSink(); + } + + @Override + public Sink createSink(OutputStream ignoredOut, String ignoredEncoding) { + return createSink(); + } +}