public class LocatorWrapper extends Object implements Locator
A wrapper implementation for locators.
Most concrete Locator
implementations in this package cannot be
extended. (They do not have public constructors, instances can only be
created through static factory methods.) If a custom Locator
implementation is to be created that can benefit from an existing locator,
composition can be used instead of inheritance. To simplify this,
this wrapper class is introduced.
LocatorWrapper
is an implementation of the Locator
interface that is based on an underlying Locator
object. All
methods are implemented to delegate to this wrapped object. This way
inheritance can be emulated by implementing desired functionality before or
after delegating to the wrapped Locator
(or skipping the call to
this object at all).
Constructor and Description |
---|
LocatorWrapper(Locator wrapped)
Creates a new instance of
LocatorWrapper and initializes it
with the given wrapped locator. |
Modifier and Type | Method and Description |
---|---|
File |
getFile()
Returns the file this locator points to.
|
InputStream |
getInputStream()
Returns the input stream this locator points to.
|
URL |
getURL()
Returns the URL this locator points to.
|
Locator |
getWrappedLocator()
Returns the wrapped
Locator . |
public LocatorWrapper(Locator wrapped)
LocatorWrapper
and initializes it
with the given wrapped locator. Per default, all methods of this class
delegate to this object. It must not be null.wrapped
- the wrapped locator (must not be null)IllegalArgumentException
- if the wrapped locator is nullpublic Locator getWrappedLocator()
Locator
. This is the object this
instance will delegate to.Locator
public File getFile()
Locator
.public InputStream getInputStream() throws IOException
Locator
.getInputStream
in interface Locator
IOException
- if an error occursCopyright © 2016 The JGUIraffe Team. All rights reserved.