Here you can find the source of findMarker(Marker marker, String name)
Parameter | Description |
---|---|
marker | the marker to search |
name | the name of the marker to find |
null
public static Marker findMarker(Marker marker, String name)
//package com.java2s; // it and/or modify it under the terms of the GNU Lesser General Public License import java.util.Iterator; import org.slf4j.Marker; public class Main { /**/* w ww.j av a2 s. c om*/ * Find the marker with the given name in the given marker or its references * * @param marker the marker to search * @param name the name of the marker to find * * @return the found marker or <code>null</code> */ public static Marker findMarker(Marker marker, String name) { if (marker == null) { return null; } if (marker.getName().equals(name)) { return marker; } else if (marker.hasReferences()) { Iterator<?> refs = marker.iterator(); while (refs.hasNext()) { Object ref = refs.next(); if (ref instanceof Marker) { Marker result = findMarker((Marker) ref, name); if (result != null) { return result; } } } return null; } else { return null; } } }