Liferay 7.0-ce-m3

com.liferay.portal.tools.sourceformatter
Class JavaSourceProcessor

java.lang.Object
  extended by com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
      extended by com.liferay.portal.tools.sourceformatter.JavaSourceProcessor
All Implemented Interfaces:
SourceProcessor

public class JavaSourceProcessor
extends BaseSourceProcessor


Field Summary
 
Fields inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
attributeNamePattern, BASEDIR, emptyCollectionPattern, fileUtil, languageKeyPattern, portalSource, saxReaderUtil, sessionKeyPattern, sourceFormatterHelper, taglibSessionKeyPattern
 
Constructor Summary
JavaSourceProcessor()
           
 
Method Summary
protected  String applyDiamondOperator(String content)
           
protected  void checkFinderCacheInterfaceMethod(String fileName, String content)
           
protected  String checkIfClause(String ifClause, String fileName, int lineCount)
           
protected  String checkIfClauseTabsAndSpaces(String ifClause)
           
protected  void checkLogLevel(String content, String fileName, String logLevel)
           
protected  void checkRegexPattern(String regexPattern, String fileName, int lineCount)
           
protected  void checkSystemEventAnnotations(String content, String fileName)
           
protected  void checkUnprocessedExceptions(String content, File file, String packagePath, String fileName)
           
protected  String doFormat(File file, String fileName, String absolutePath, String content)
           
protected  String fixDataAccessConnection(String className, String content)
           
protected  String fixIfClause(String ifClause, String line, int delta)
           
protected  String fixIncorrectEmptyLineBeforeCloseCurlyBrace(String content, String fileName)
           
protected  String fixSystemExceptions(String content)
           
protected  void format()
           
protected  String formatJava(String fileName, String absolutePath, String content)
           
protected  String getCombinedLinesContent(String content, String fileName, String line, String trimmedLine, int lineLength, int lineCount, String previousLine, String linePart, int tabDiff, boolean addToPreviousLine, boolean extraSpace, boolean removeTabOnNextLine)
           
protected  String getCombinedLinesContent(String content, String fileName, String absolutePath, String line, String trimmedLine, int lineLength, int lineCount, String previousLine, int lineTabCount, int previousLineTabCount)
           
protected  List<String> getImportedExceptionClassNames(com.thoughtworks.qdox.JavaDocBuilder javaDocBuilder)
           
protected static int getLeadingTabCount(String line)
           
protected  int getLineLength(String line)
           
protected  String getNextLine(String content, int lineCount)
           
protected  Collection<String> getPluginJavaFiles()
           
protected  Collection<String> getPortalJavaFiles()
           
protected  String getTruncateLongLinesContent(String content, String line, String trimmedLine, int lineCount)
           
protected  boolean isAnnotationParameter(String content, String line)
           
protected  boolean isGenerated(String content)
           
protected  boolean isValidJavaParameter(String javaParameter)
           
protected static String sortAnnotations(String content, String indent)
           
protected  String sortExceptions(String line)
           
static String stripJavaImports(String content, String packageDir, String className)
           
 
Methods inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
checkEmptyCollection, checkIfClauseParentheses, checkInefficientStringMethods, checkLanguageKeys, checkStringBundler, fixCompatClassImports, fixCopyright, fixIncorrectParameterTypeForLanguageUtil, fixSessionKey, format, format, format, format, formatJavaTerms, formatTagAttributeType, getAbsolutePath, getAnnotationsExclusions, getCompatClassNamesMap, getContent, getCustomCopyright, getErrorMessages, getFile, getFileNames, getFileNames, getFirstSourceMismatchException, getImmutableFieldTypes, getLanguageKeys, getLanguageProperties, getMainReleaseVersion, getProperty, getPropertyList, hasMissingParentheses, hasRedundantParentheses, hasRedundantParentheses, isAttributName, isExcluded, isExcluded, isExcluded, isRunsOutsidePortal, processErrorMessage, processFormattedFile, replacePrimitiveWrapperInstantiation, sortAttributes, stripLine, stripQuotes, stripRedundantParentheses, trimContent, trimLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSourceProcessor

public JavaSourceProcessor()
Method Detail

stripJavaImports

public static String stripJavaImports(String content,
                                      String packageDir,
                                      String className)
                               throws IOException
Throws:
IOException

getLeadingTabCount

protected static int getLeadingTabCount(String line)

sortAnnotations

protected static String sortAnnotations(String content,
                                        String indent)
                                 throws IOException
Throws:
IOException

applyDiamondOperator

protected String applyDiamondOperator(String content)

checkFinderCacheInterfaceMethod

protected void checkFinderCacheInterfaceMethod(String fileName,
                                               String content)

checkIfClause

protected String checkIfClause(String ifClause,
                               String fileName,
                               int lineCount)
                        throws IOException
Throws:
IOException

checkIfClauseTabsAndSpaces

protected String checkIfClauseTabsAndSpaces(String ifClause)
                                     throws IOException
Throws:
IOException

checkLogLevel

protected void checkLogLevel(String content,
                             String fileName,
                             String logLevel)

checkRegexPattern

protected void checkRegexPattern(String regexPattern,
                                 String fileName,
                                 int lineCount)

checkSystemEventAnnotations

protected void checkSystemEventAnnotations(String content,
                                           String fileName)
                                    throws Exception
Throws:
Exception

checkUnprocessedExceptions

protected void checkUnprocessedExceptions(String content,
                                          File file,
                                          String packagePath,
                                          String fileName)
                                   throws IOException
Throws:
IOException

doFormat

protected String doFormat(File file,
                          String fileName,
                          String absolutePath,
                          String content)
                   throws Exception
Specified by:
doFormat in class BaseSourceProcessor
Throws:
Exception

fixDataAccessConnection

protected String fixDataAccessConnection(String className,
                                         String content)

fixIfClause

protected String fixIfClause(String ifClause,
                             String line,
                             int delta)

fixIncorrectEmptyLineBeforeCloseCurlyBrace

protected String fixIncorrectEmptyLineBeforeCloseCurlyBrace(String content,
                                                            String fileName)

fixSystemExceptions

protected String fixSystemExceptions(String content)

format

protected void format()
               throws Exception
Specified by:
format in class BaseSourceProcessor
Throws:
Exception

formatJava

protected String formatJava(String fileName,
                            String absolutePath,
                            String content)
                     throws Exception
Throws:
Exception

getCombinedLinesContent

protected String getCombinedLinesContent(String content,
                                         String fileName,
                                         String line,
                                         String trimmedLine,
                                         int lineLength,
                                         int lineCount,
                                         String previousLine,
                                         String linePart,
                                         int tabDiff,
                                         boolean addToPreviousLine,
                                         boolean extraSpace,
                                         boolean removeTabOnNextLine)

getCombinedLinesContent

protected String getCombinedLinesContent(String content,
                                         String fileName,
                                         String absolutePath,
                                         String line,
                                         String trimmedLine,
                                         int lineLength,
                                         int lineCount,
                                         String previousLine,
                                         int lineTabCount,
                                         int previousLineTabCount)

getImportedExceptionClassNames

protected List<String> getImportedExceptionClassNames(com.thoughtworks.qdox.JavaDocBuilder javaDocBuilder)

getLineLength

protected int getLineLength(String line)

getNextLine

protected String getNextLine(String content,
                             int lineCount)

getPluginJavaFiles

protected Collection<String> getPluginJavaFiles()

getPortalJavaFiles

protected Collection<String> getPortalJavaFiles()

getTruncateLongLinesContent

protected String getTruncateLongLinesContent(String content,
                                             String line,
                                             String trimmedLine,
                                             int lineCount)

isAnnotationParameter

protected boolean isAnnotationParameter(String content,
                                        String line)

isGenerated

protected boolean isGenerated(String content)

isValidJavaParameter

protected boolean isValidJavaParameter(String javaParameter)

sortExceptions

protected String sortExceptions(String line)

Liferay 7.0-ce-m3