@MinDoc(copyright="Copyright 2001 - 2005 , 2009 A. Weinert", author="Albrecht Weinert", version="V.33", lastModified="27.03.2021", usage="use for generating relative links", purpose="provide a link relocator using a give base location") public final class LocForRel extends Object
location
of a file, either
absolute or site root related (common root). This common root itself is
not relevant and will not be stored in a LocForRel
object. An
example for a location would berelRef(CharSequence)
accept
a link denotation like used in href, class, img or else parameters in a
HTML page. This denotation must be either absolute or related to a common
root, just as is the case for location
. In this case the method
relRef(CharSequence)
makes from that, when ever possible, a link
that is relative to location
.LocForRel
object be constructed without
default anchor computerScience.html would be returned in this case.location
). The common site root (or the absolute placements)
will not be recorded in the object; for all uses, i.e. for all parameters
ref
(relRef(ref)
) that must be
(implicitly) the same. Fulfilling this condition is the application's
responsibility.Modifier and Type | Field and Description |
---|---|
String |
ank
The page's anchorage part.
|
boolean |
isDir
The page's address is a directory.
|
String |
location
The page's address.
|
int |
locationDepth
Directory depth of
location . |
boolean |
lowerCase
All link specifications in lower case.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Equality with other object.
|
int |
hashCode() |
static LocForRel |
make(CharSequence address,
boolean lowerCase)
Make a LocForRel object.
|
String |
relRef(CharSequence ref)
Working method: make a site root based link relative.
|
String |
toString()
State as String.
|
public final String location
relRef(CharSequence)
just returns the provided
link, except for changing to lowerCase
if so set.ank
public final boolean isDir
public final String ank
location
and stored including the # in ank
. In
ank
the original case remains independent of
lowerCase
.ank
equals null means that this object was made with an
address without anchor (see
#make(address, lowerCase)
.relRef(CharSequence)
public final boolean lowerCase
public final int locationDepth
public static LocForRel make(CharSequence address, boolean lowerCase) throws IllegalArgumentException
address
denotation \ will be replaced by / and surrounding
white space removed.ank
; the real address goes to location
.
address
- all other links will be related to itlowerCase
- true: All links will be considered and worked on in
lower case;
location
will be stored in lower caseIllegalArgumentException
- on address errorspublic String relRef(CharSequence ref)
public boolean equals(Object other)