org.netbeans.modules.extexecution/2 1.25.1

org.netbeans.api.extexecution.print
Class LineConvertors

java.lang.Object
  extended by org.netbeans.api.extexecution.print.LineConvertors

public final class LineConvertors
extends Object

Factory methods for LineConvertor classes.


Nested Class Summary
static interface LineConvertors.FileLocator
          Locates the file for the given path, file or part of the path.
 
Method Summary
static LineConvertor filePattern(LineConvertors.FileLocator fileLocator, Pattern linePattern, Pattern filePattern, int fileGroup, int lineGroup)
          Returns the convertor searching for lines matching the patterns, considering matched lines as being files.
static LineConvertor httpUrl()
          Returns the convertor parsing the line and searching for http or https URL.
static LineConvertor proxy(LineConvertor... convertors)
          Returns the convertor that will delegate to passed converters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

proxy

@NonNull
public static LineConvertor proxy(@NonNull
                                          LineConvertor... convertors)
Returns the convertor that will delegate to passed converters.

On call to LineConvertor.convert(java.lang.String) converters are asked one by one for conversion in the same order they were passed to constructor. The first non null value is returned. If all coverters return null for particular line null is returned.

Returned convertor is not thread safe.

Parameters:
convertors - convertors that will be proxied; the same order is used on LineConvertor.convert(java.lang.String) invocation
Returns:
the convertor proxying passed convertors

filePattern

@NonNull
public static LineConvertor filePattern(@NullAllowed
                                                LineConvertors.FileLocator fileLocator,
                                                @NonNull
                                                Pattern linePattern,
                                                @NullAllowed
                                                Pattern filePattern,
                                                int fileGroup,
                                                int lineGroup)
Returns the convertor searching for lines matching the patterns, considering matched lines as being files.

Convertor is trying to mach each line against the given linePattern. If the line matches the regexp group number fileGroup is supposed to be filename. This filename is then checked whether it matches filePattern (if any).

In next step converter tries to determine the line in file. The line is parsed as lineGroup regexp group. Line number begins with 1 (first line of the file). If resulting value representing line number can't be parsed or is less then or equal to zero the OutputListener associated with converted line will use value 1 as a line number.

When the line does not match the linePattern or received filename does not match filePattern null is returned.

Resulting converted line contains the original text and a listener that consults the fileLocator (if any) when clicked and displays the received file in the editor. If fileLocator is null output listener will try to find file simply by new File(filename) checking its existence by isFile().

Returned convertor is not thread safe.

Parameters:
fileLocator - locator that is consulted for real file; used in listener for the converted line; may be null
linePattern - pattern for matching the line
filePattern - pattern for matching once received filenames; may be null
fileGroup - regexp group supposed to be the filename; only nonnegative numbers allowed
lineGroup - regexp group supposed to be the line number; if negative line number is not parsed
Returns:
the convertor searching for lines matching the patterns, considering matched lines as being files (names or paths)

httpUrl

@NonNull
public static LineConvertor httpUrl()
Returns the convertor parsing the line and searching for http or https URL.

Converted line returned from the processor consist from the original line and listener opening browser with recognized url on click.

If line is not recognized as http or https URL null is returned.

Returned convertor is not thread safe.

Returns:
the convertor parsing the line and searching for http or https URL

org.netbeans.modules.extexecution/2 1.25.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.