Class TypeUtil


  • public final class TypeUtil
    extends Object
    The utility class for common functions for StringLiteral content type processing.
    • Field Detail

      • HEADER_ANNOTATION_PATTERN

        public static final Pattern HEADER_ANNOTATION_PATTERN
      • INLINE_ANNOTATION_PATTERN

        public static final Pattern INLINE_ANNOTATION_PATTERN
      • DEFAULT_STRING_LITERAL_CONTENT_TYPE_ENABLED

        public static boolean DEFAULT_STRING_LITERAL_CONTENT_TYPE_ENABLED
        The default settings of string literal content type computing.
      • KEY_STRING_LITERAL_CONTENT_TYPE_ENABLED

        public static String KEY_STRING_LITERAL_CONTENT_TYPE_ENABLED
        The key of settings of string literal content type computing.
      • NODE_STRING_LITERAL_CONTENT_TYPE_ENABLED

        public static String NODE_STRING_LITERAL_CONTENT_TYPE_ENABLED
        The node of string literal content type computing.
    • Method Detail

      • isStringLiteralContentTypesEnabled

        public static boolean isStringLiteralContentTypesEnabled()
        Checks if string literal content types computing is enabled.
        Returns:
        true, if string literal content types computing is enabled
      • setStringLiteralContentTypesEnabled

        public static void setStringLiteralContentTypesEnabled​(boolean enable)
        Sets the string literal content types computing enable status.
        Parameters:
        enable - the new enable status of computing string literal content types
      • getActualSemanticObjectForLine

        public static org.eclipse.emf.ecore.EObject getActualSemanticObjectForLine​(org.eclipse.emf.ecore.EObject object)
        Gets the actual semantic object for line.
        Parameters:
        object - the object to get the line from, cannot be null.
        Returns:
        the actual semantic object for line or may be the same object from parameter, cannot return null.
      • getCommentLinesFromRight

        public static List<org.eclipse.xtext.nodemodel.INode> getCommentLinesFromRight​(org.eclipse.emf.ecore.EObject object)
        Gets the comment lines from right of the object.
        Parameters:
        object - the object, cannot be null.
        Returns:
        the comment lines from right, cannot return null.
      • getStringLiteralsInLine

        public static List<StringLiteral> getStringLiteralsInLine​(StringLiteral object)
        Gets the string literals in same line as given literal.
        Parameters:
        object - the object, cannot be null.
        Returns:
        the string literals in line, cannot return null.
      • getStringLiteralsInLine

        public static List<StringLiteral> getStringLiteralsInLine​(org.eclipse.xtext.nodemodel.INode node,
                                                                  int currentLine)
        Gets the string literals in line.
        Parameters:
        node - the node, cannot be null.
        currentLine - the current line, cannot be null.
        Returns:
        the sting literals in line, cannot return null.
      • parseHeaderAnnotations

        public static List<org.eclipse.xtext.util.Triple<String,​Integer,​String>> parseHeaderAnnotations​(String comment)
        Parses the header annotations.
        Parameters:
        comment - the comment, cannot be null.
        Returns:
        the list of annotations, position and description of annotation in string, cannot return null.
      • parseInLineAnnotations

        public static org.eclipse.xtext.util.Pair<List<org.eclipse.xtext.util.Pair<String,​Integer>>,​String> parseInLineAnnotations​(String comment)
        Parses the in-line annotations from comment string.
        Parameters:
        comment - the comment, cannot be null.
        Returns:
        the pair of list of annotations and position, and common description for all annotations in the line, cannot return null.
      • getAnnotationOffsetAndLength

        public static org.eclipse.xtext.util.Pair<Integer,​Integer> getAnnotationOffsetAndLength​(LiteralType type,
                                                                                                      org.eclipse.xtext.nodemodel.ICompositeNode literalNode,
                                                                                                      int indexOnLastLine,
                                                                                                      org.eclipse.xtext.nodemodel.INode annotationNode)
        Gets the annotation offset and length by annotation type description.
        Parameters:
        type - the literal type description to find it's position, cannot be null.
        literalNode - the literal node, cannot be null.
        indexOnLastLine - the index on last line, cannot be null.
        annotationNode - the annotation node, cannot be null.
        Returns:
        the annotation offset and length, cannot be null.