Interface IStringLiteralTypeComputer
-
public interface IStringLiteralTypeComputer
The service of computingStringLiteral
content types. Service providesstring literal type description
of the literal that may be annotated type or computedby context
of using literal in invocation/constructor parameters or computedby content
of the literal.
EachStringLiteral
may have single content type which is unique in some scope and may have unlimited non-scoped content types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<LiteralType>
allTypes()
Provider all registered types.Collection<LiteralType>
computeTypes(StringLiteral literal)
Computes the string literal content types.boolean
containsAnyType(StringLiteral literal, String... typeNames)
Checks that string literal content types contains any of given type.boolean
containsAnyType(Collection<LiteralType> types, String... typeNames)
Checks that collection of content types contains any of given type.Collection<LiteralType>
getAnnotatedTypes(StringLiteral literal)
Gets the only annotated types of string literal content types.Map<LiteralType,org.eclipse.xtext.nodemodel.INode>
getAnnotationNodes(StringLiteral literal)
Gets the nodes which contains annotation of the content type for the string literal.Map<LiteralType,Collection<TypeComputer>>
getComputers()
Gets the computers groupped by string literal content type.LiteralType
getType(String typeName)
Gets thestring literal type description
by it's name ID.String
getTypeDescription(LiteralType type)
Gets the localizable description ofStringLiteral
content type.String
getTypeDescription(String typeName)
Gets the localizable description ofStringLiteral
content type.Map<LiteralType,Collection<TypeValidator>>
getValidators()
Gets the validators of string literal content types.int
indexOnLastLine(StringLiteral literal)
Get the index of string literal on last line of string literal lines.
-
-
-
Method Detail
-
computeTypes
Collection<LiteralType> computeTypes(StringLiteral literal)
Computes the string literal content types.- Parameters:
literal
- the string literal to compute it's types, cannot benull
.- Returns:
- the collection of computed or annotated string literal content types, cannot return
null
.
-
containsAnyType
boolean containsAnyType(StringLiteral literal, String... typeNames)
Checks that string literal content types contains any of given type.- Parameters:
literal
- the string literal, can benull
.typeNames
- theStringLiteral
content type names, can benull
.- Returns:
- true, if any of given types contains in the string literal content types
-
containsAnyType
boolean containsAnyType(Collection<LiteralType> types, String... typeNames)
Checks that collection of content types contains any of given type.- Parameters:
types
- the collection of string literal content types, can benull
.typeNames
- theStringLiteral
content type names, can benull
.- Returns:
- true, if any of given types contains in the string literal content types
-
getAnnotatedTypes
Collection<LiteralType> getAnnotatedTypes(StringLiteral literal)
Gets the only annotated types of string literal content types.- Parameters:
literal
- the literal to collect annotating types, cannot benull
.- Returns:
- the annotated types of string literal content types, cannot return
null
.
-
getAnnotationNodes
Map<LiteralType,org.eclipse.xtext.nodemodel.INode> getAnnotationNodes(StringLiteral literal)
Gets the nodes which contains annotation of the content type for the string literal.- Parameters:
literal
- the literal to get it's content type annotation nodes, cannot benull
.- Returns:
- the annotation nodes, cannot return
null
.
-
indexOnLastLine
int indexOnLastLine(StringLiteral literal)
Get the index of string literal on last line of string literal lines. If the string literal has multi-line content then it's index is 0 as first literal.- Parameters:
literal
- the string literal to get the index, cannot benull
.- Returns:
- the index on the last line of literal lines, first index is 0. If return -1 this means cannot determine position of the literal in the line of code, might be some error or string literal is not part of Xtext code.
-
allTypes
Collection<LiteralType> allTypes()
Provider all registered types. Caller cannot modify this collection and should contribute string literal type description in extension point.- Returns:
- the collection of types, cannot return
null
.
-
getType
LiteralType getType(String typeName)
Gets thestring literal type description
by it's name ID.- Parameters:
typeName
- theStringLiteral
content type name ID, can benull
.- Returns:
- the type by it's name, can return
null
.
-
getTypeDescription
String getTypeDescription(LiteralType type)
Gets the localizable description ofStringLiteral
content type.- Parameters:
type
- the string literal type description, cannot benull
.- Returns:
- the type localizable description, can return
null
.
-
getTypeDescription
String getTypeDescription(String typeName)
Gets the localizable description ofStringLiteral
content type.- Parameters:
typeName
- theStringLiteral
content type name, can benull
.- Returns:
- the type localizable description, can return
null
.
-
getValidators
Map<LiteralType,Collection<TypeValidator>> getValidators()
Gets the validators of string literal content types.- Returns:
- the validators allow to check content of string literal
that it valid for annotated type, cannot return
null
.
-
getComputers
Map<LiteralType,Collection<TypeComputer>> getComputers()
Gets the computers groupped by string literal content type.- Returns:
- the computers, cannot return
null
.
-
-