Class Source
- java.lang.Object
-
- org.apache.logging.log4j.core.util.Source
-
- Direct Known Subclasses:
LastModifiedSource
@NullMarked public class Source extends Object
Represents the source for the logging configuration as an immutable object.
-
-
Constructor Summary
Constructors Constructor Description Source(File file)Constructs a newSourcewith the specified file.Source(URI uri)Constructs a newSourcefrom the specified URI.Source(URI uri, long ignored)Deprecated.UseSource(URI).Source(URL url)Constructs a newSourcefrom the specified URL.Source(Path path)Constructs a newSourcefrom the specified Path.Source(ConfigurationSource source)Constructs a Source from a ConfigurationSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)@Nullable FilegetFile()Gets the file configuration source, ornullif this configuration source is based on an URL or has neither a file nor an URL.StringgetLocation()Gets a string describing the configuration source file or URI, ornullif this configuration source has neither a file nor an URI.PathgetPath()Gets this source as a Path.URIgetURI()Gets the configuration source URI, ornullif this configuration source is based on a file or has neither a file nor an URI.URLgetURL()Gets the configuration source URL.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
Source
public Source(ConfigurationSource source)
Constructs a Source from a ConfigurationSource.- Parameters:
source- The ConfigurationSource.- Throws:
NullPointerException- ifsourceisnull.
-
Source
public Source(File file)
Constructs a newSourcewith the specified file. file.- Parameters:
file- the file where the input stream originated.- Throws:
NullPointerException- iffileisnull.
-
Source
public Source(Path path)
Constructs a newSourcefrom the specified Path.- Parameters:
path- the Path where the input stream originated- Throws:
NullPointerException- ifpathisnull.
-
Source
public Source(URI uri)
Constructs a newSourcefrom the specified URI.- Parameters:
uri- the URI where the input stream originated- Throws:
NullPointerException- ifuriisnull.
-
Source
@Deprecated public Source(URI uri, long ignored)
Deprecated.UseSource(URI).Constructs a newSourcefrom the specified URI.- Parameters:
uri- the URI where the input stream originatedignored- Not used.- Throws:
NullPointerException- ifuriisnull.
-
Source
public Source(URL url)
Constructs a newSourcefrom the specified URL.- Parameters:
url- the URL where the input stream originated- Throws:
NullPointerException- if this URL isnull.IllegalArgumentException- if this URL is not formatted strictly according to RFC2396 and cannot be converted to a URI.
-
-
Method Detail
-
getFile
public @Nullable File getFile()
Gets the file configuration source, ornullif this configuration source is based on an URL or has neither a file nor an URL.- Returns:
- the configuration source file, or
null
-
getLocation
public String getLocation()
Gets a string describing the configuration source file or URI, ornullif this configuration source has neither a file nor an URI.- Returns:
- a string describing the configuration source file or URI, or
null
-
getPath
public Path getPath()
Gets this source as a Path.- Returns:
- this source as a Path.
-
getURI
public URI getURI()
Gets the configuration source URI, ornullif this configuration source is based on a file or has neither a file nor an URI.- Returns:
- the configuration source URI, or
null
-
getURL
public URL getURL()
Gets the configuration source URL.- Returns:
- the configuration source URI, or
null
-
-