/*
 * Copyright 2017 Eric A. Snell
 *
 * This file is part of eAlvaLog.
 *
 * Licensed 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 com.ealva.ealvalog

import java.io.ObjectStreamException
import java.util.Formatter

/**
 * A no-op implementation of the [Marker] interface
 *
 * Created by Eric A. Snell on 2/28/17.
 */
@Suppress("unused")
object NullMarker : Marker {
  private const val serialVersionUID = -6861067652369180156L
  override val name = "NullMarker"
  override fun add(marker: Marker) = false
  override fun remove(marker: Marker) = false
  override fun isOrContains(marker: Marker) = false
  override fun isOrContains(markerName: String) = false
  override fun iterator(): Iterator<Marker> = emptyList<Marker>().iterator()
  override fun toStringBuilder(builder: StringBuilder, includeContained: Boolean) = builder
  override fun formatTo(formatter: Formatter, flags: Int, width: Int, precision: Int) {}
  @Throws(ObjectStreamException::class)
  private fun readResolve(): Any = NullMarker
}
