Liferay 7.0-ce-m2

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  String checkFinalableFieldType(com.thoughtworks.qdox.model.JavaClass javaClass, com.thoughtworks.qdox.model.JavaClass[] javaClasses, com.thoughtworks.qdox.model.JavaField javaField, String content)
           
protected  void checkFinderCacheInterfaceMethod(String fileName, String content)
           
protected  String checkIfClause(String ifClause, String fileName, int lineCount)
           
protected  String checkIfClauseTabsAndSpaces(String ifClause)
           
protected  String checkImmutableFieldType(com.thoughtworks.qdox.model.JavaField javaField, com.thoughtworks.qdox.model.Type javaFieldType, String content)
           
protected  String checkJavaFieldTypes(String fileName, String absolutePath, String packagePath, String className, String content)
           
protected  void checkLogLevel(String content, String fileName, String logLevel)
           
protected  void checkRegexPattern(String regexPattern, String fileName, int lineCount)
           
protected  String checkStaticableFieldType(com.thoughtworks.qdox.model.JavaField javaField, com.thoughtworks.qdox.model.Type javaFieldType, String content)
           
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, 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  Set<String> getImmutableFieldTypes()
           
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  boolean isAnnotationParameter(String content, String line)
           
protected  boolean isGenerated(String content)
           
protected  boolean isValidJavaParameter(String javaParameter)
           
protected  String sanitizeContent(String content)
           
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, getAbsolutePath, getCompatClassNamesMap, getContent, getCustomCopyright, getErrorMessages, getFile, getFileNames, getFileNames, getFirstSourceMismatchException, 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)

checkFinalableFieldType

protected String checkFinalableFieldType(com.thoughtworks.qdox.model.JavaClass javaClass,
                                         com.thoughtworks.qdox.model.JavaClass[] javaClasses,
                                         com.thoughtworks.qdox.model.JavaField javaField,
                                         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

checkImmutableFieldType

protected String checkImmutableFieldType(com.thoughtworks.qdox.model.JavaField javaField,
                                         com.thoughtworks.qdox.model.Type javaFieldType,
                                         String content)

checkJavaFieldTypes

protected String checkJavaFieldTypes(String fileName,
                                     String absolutePath,
                                     String packagePath,
                                     String className,
                                     String content)

checkLogLevel

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

checkRegexPattern

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

checkStaticableFieldType

protected String checkStaticableFieldType(com.thoughtworks.qdox.model.JavaField javaField,
                                          com.thoughtworks.qdox.model.Type javaFieldType,
                                          String content)

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,
                                         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)

getImmutableFieldTypes

protected Set<String> getImmutableFieldTypes()

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()

isAnnotationParameter

protected boolean isAnnotationParameter(String content,
                                        String line)

isGenerated

protected boolean isGenerated(String content)

isValidJavaParameter

protected boolean isValidJavaParameter(String javaParameter)

sanitizeContent

protected String sanitizeContent(String content)

sortExceptions

protected String sortExceptions(String line)

Liferay 7.0-ce-m2