|
org.netbeans.modules.lexer/2 1.19.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.lexer.LanguagePath
public final class LanguagePath
Language path describes a complete embedding
of the languages starting from the root (top-level) language
till the most embedded language.
Language path consists of one root language
and zero or more embedded languages.
E.g. for javadoc embedded in java that is embedded in jsp
then the language path lp
would return the following:
lp.size() == 3 lp.language(0) == JspTokenId.language() lp.language(1) == JavaTokenId.language() lp.language(2) == JavadocTokenId.language()
The two language paths for the same languages in the same order represent a single object. Therefore language paths can be compared by using == operator.
Lifetime: Once a particular language path is created it is held by a soft reference from its "parent" language path.
This class may safely be used by multiple threads.
Method Summary | |
---|---|
LanguagePath |
embedded(Language<? extends TokenId> language)
Get embedded path of this language path. |
LanguagePath |
embedded(LanguagePath suffix)
Get language path corresponding to the suffix language path embedded in this path. |
boolean |
endsWith(LanguagePath languagePath)
Check whether this language path ends with the given language path. |
static LanguagePath |
get(Language<? extends TokenId> language)
Get language path that contains a single language. |
static LanguagePath |
get(LanguagePath prefix,
Language<? extends TokenId> language)
Get language path corresponding to the language embedded in the given context language path. |
Language<? extends TokenId> |
innerLanguage()
Return the most inner language of this path. |
boolean |
isInnerLanguage(Language<? extends TokenId> language)
Check whether the most inner language of this language path is the given language. |
boolean |
isLanguage(int index,
Language<? extends TokenId> language)
Check whether the language of this language path at the given index is the given language. |
boolean |
isTopLanguage(Language<? extends TokenId> language)
Check whether the top-level language of this language path is the given language. |
Language<? extends TokenId> |
language(int index)
Get language of this language path at the given index. |
String |
mimePath()
Gets the mime path equivalent of this language path. |
int |
size()
Get total number of languages in this language path. |
LanguagePath |
subPath(int startIndex)
Gets the path starting at the given index and ending after the last language contained in this path. |
LanguagePath |
subPath(int startIndex,
int endIndex)
Gets the path starting at the given index and ending after the last language contained in this path. |
Language<? extends TokenId> |
topLanguage()
Return the top-level language of this language path. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static LanguagePath get(Language<? extends TokenId> language)
language
- non-null language.
public static LanguagePath get(LanguagePath prefix, Language<? extends TokenId> language)
embedded(Language)
.
prefix
- prefix language path determining the context in which
the language is embedded or null if there is no prefix.language
- non-null language.
public int size()
public Language<? extends TokenId> language(int index)
index
- >=0 && < size()
.
IndexOutOfBoundsException
- in case the index is not within
required bounds.public LanguagePath embedded(Language<? extends TokenId> language)
get(LanguagePath,Language)
but this one is usually preferred as it supports more readable code.
language
- non-null language.
public LanguagePath embedded(LanguagePath suffix)
suffix
- non-null suffix to be added to this path.
public boolean isLanguage(int index, Language<? extends TokenId> language)
index
- >=0 && < size()
.
IndexOutOfBoundsException
- in case the index is not within
required bounds.public Language<? extends TokenId> topLanguage()
language(0)
.
language(int)
public boolean isTopLanguage(Language<? extends TokenId> language)
isLanguage(int, Language)
public Language<? extends TokenId> innerLanguage()
language(size() - 1)
.
language(int)
public boolean isInnerLanguage(Language<? extends TokenId> language)
isLanguage(int, Language)
public boolean endsWith(LanguagePath languagePath)
languagePath
- non-null language path to be checked.
this
as well).public LanguagePath subPath(int startIndex)
subPath(int, int)
public LanguagePath subPath(int startIndex, int endIndex)
startIndex
- >=0 starting index of the requested path in this path.endIndex
- >startIndex index after the last item
of the requested path.
public String mimePath()
For example the language path of the java language embedded in the JSP language will return 'text/x-jsp/text/x-java' when this method is called.
The returned string path can be used in MimeLookup's operation
to obtain a corresponding MimePath object by using
MimePath.parse(returned-mime-path-string)
.
LanguageHierarchy.mimeType()
public String toString()
|
org.netbeans.modules.lexer/2 1.19.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |