Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.api
Class Utils  view Utils download Utils.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.Utils

public final class Utils
extends java.lang.Object

Contains utility methods.

Version:
1.0

Field Summary
private static java.util.Map CREATED_RES
          Map of all created regular expressions
private static org.apache.commons.logging.Log EXCEPTION_LOG
          Shared instance of logger for exception logging.
 
Constructor Summary
private Utils()
          stop instances being created
 
Method Summary
static java.lang.String baseClassname(java.lang.String aType)
           
static org.apache.regexp.RE createRE(java.lang.String aPattern)
          Helper method to create a regular expression.
static org.apache.commons.logging.Log getExceptionLogger()
          Accessor for shared instance of logger which should be used to log all exceptions occured during FileSetCheck work (debug() should be used).
static java.lang.String[] getLines(java.lang.String aFileName)
          Loads the contents of a file in a String array.
static org.apache.regexp.RE getRE(java.lang.String aPattern)
          This is a factory method to return an RE object for the specified regular expression.
static java.lang.String getStrippedFileName(java.lang.String aBasedir, java.lang.String aFileName)
          Create a stripped down version of a filename.
static int lengthExpandedTabs(java.lang.String aString, int aToIdx, int aTabWidth)
          Returns the length of a String prefix with tabs expanded.
static int lengthMinusTrailingWhitespace(java.lang.String aLine)
          Returns the length of a string ignoring all trailing whitespace.
static boolean whitespaceBefore(int aIndex, java.lang.String aLine)
          Returns whether the specified string contains only whitespace up to the specified index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATED_RES

private static final java.util.Map CREATED_RES
Map of all created regular expressions


EXCEPTION_LOG

private static final org.apache.commons.logging.Log EXCEPTION_LOG
Shared instance of logger for exception logging.

Constructor Detail

Utils

private Utils()
stop instances being created

Method Detail

getExceptionLogger

public static org.apache.commons.logging.Log getExceptionLogger()
Accessor for shared instance of logger which should be used to log all exceptions occured during FileSetCheck work (debug() should be used).


whitespaceBefore

public static boolean whitespaceBefore(int aIndex,
                                       java.lang.String aLine)
Returns whether the specified string contains only whitespace up to the specified index.


lengthMinusTrailingWhitespace

public static int lengthMinusTrailingWhitespace(java.lang.String aLine)
Returns the length of a string ignoring all trailing whitespace. It is a pity that there is not a trim() like method that only removed the trailing whitespace.


lengthExpandedTabs

public static int lengthExpandedTabs(java.lang.String aString,
                                     int aToIdx,
                                     int aTabWidth)
Returns the length of a String prefix with tabs expanded. Each tab is counted as the number of characters is takes to jump to the next tab stop.


getRE

public static org.apache.regexp.RE getRE(java.lang.String aPattern)
                                  throws org.apache.regexp.RESyntaxException
This is a factory method to return an RE object for the specified regular expression. This method is not MT safe, but neither are the returned RE objects.


getLines

public static java.lang.String[] getLines(java.lang.String aFileName)
                                   throws java.io.IOException
Loads the contents of a file in a String array.


createRE

public static org.apache.regexp.RE createRE(java.lang.String aPattern)
                                     throws org.apache.commons.beanutils.ConversionException
Helper method to create a regular expression.


baseClassname

public static java.lang.String baseClassname(java.lang.String aType)

getStrippedFileName

public static java.lang.String getStrippedFileName(java.lang.String aBasedir,
                                                   java.lang.String aFileName)
Create a stripped down version of a filename.