com.liferay.portal.tools.sourceformatter
Class JavaSourceProcessor
java.lang.Object
com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
com.liferay.portal.tools.sourceformatter.JavaSourceProcessor
- All Implemented Interfaces:
- SourceProcessor
public class JavaSourceProcessor
- extends BaseSourceProcessor
Fields inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor |
BASEDIR, fileUtil, languageKeyPattern, MAIN_RELEASE_VERSION_6_1_0, MAIN_RELEASE_VERSION_6_2_0, mainReleaseVersion, portalSource, saxReaderUtil, sessionKeyPattern, sourceFormatterHelper, taglibSessionKeyPattern |
Method Summary |
protected List<String> |
addParameterTypes(String line,
List<String> parameterTypes)
|
protected void |
checkAnnotationForMethod(JavaTerm javaTerm,
String annotation,
String requiredMethodNameRegex,
int requiredMethodType,
String fileName)
|
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 |
checkTestAnnotations(JavaTerm javaTerm,
String fileName)
|
protected void |
checkUnprocessedExceptions(String content,
File file,
String packagePath,
String fileName)
|
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 |
fixJavaTermsDividers(String fileName,
String content,
Set<JavaTerm> javaTerms)
|
protected void |
format()
|
protected String |
format(String fileName)
|
protected String |
formatAnnotations(String fileName,
String content,
Set<JavaTerm> javaTerms)
|
protected String |
formatJava(String fileName,
String content)
|
protected String |
getClassName(String line)
|
protected Tuple |
getCombinedLines(String line,
String previousLine,
int lineTabCount,
int previousLineTabCount)
|
protected String |
getConstructorOrMethodName(String line,
int pos)
|
protected List<String> |
getImportedExceptionClassNames(com.thoughtworks.qdox.JavaDocBuilder javaDocBuilder)
|
protected Tuple |
getJavaTermTuple(String line,
String content,
int index,
int numLines,
int maxLines)
|
protected int |
getLeadingTabCount(String line)
|
protected int |
getLineLength(String line)
|
protected Collection<String> |
getPluginJavaFiles()
|
protected Collection<String> |
getPortalJavaFiles()
|
protected String |
getVariableName(String line)
|
protected boolean |
hasAnnotationCommentOrJavadoc(String s)
|
protected boolean |
isGenerated(String content)
|
protected static boolean |
isInJavaTermTypeGroup(int javaTermType,
int[] javaTermTypeGroup)
|
protected boolean |
isValidJavaParameter(String javaParameter)
|
protected String |
sortExceptions(String line)
|
protected String |
sortJavaTerms(String fileName,
String content,
Set<JavaTerm> javaTerms)
|
static String |
stripJavaImports(String content,
String packageDir,
String className)
|
Methods inherited from class com.liferay.portal.tools.sourceformatter.BaseSourceProcessor |
checkIfClauseParentheses, checkInefficientStringMethods, checkLanguageKeys, checkStringBundler, fixCompatClassImports, fixCopyright, fixSessionKey, format, format, formatImports, getCompatClassNamesMap, getCopyright, getCustomCopyright, getErrorMessages, getExclusionsProperties, getFileNames, getFileNames, getLanguageKeys, getOldCopyright, hasMissingParentheses, hasRedundantParentheses, isAutoFix, processErrorMessage, replacePrimitiveWrapperInstantiation, stripQuotes, stripRedundantParentheses, stripTopLevelDirectories, trimContent, trimLine |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TYPE_CLASS_PRIVATE
public static final int TYPE_CLASS_PRIVATE
- See Also:
- Constant Field Values
TYPE_CLASS_PRIVATE_STATIC
public static final int TYPE_CLASS_PRIVATE_STATIC
- See Also:
- Constant Field Values
TYPE_CLASS_PROTECTED
public static final int TYPE_CLASS_PROTECTED
- See Also:
- Constant Field Values
TYPE_CLASS_PROTECTED_STATIC
public static final int TYPE_CLASS_PROTECTED_STATIC
- See Also:
- Constant Field Values
TYPE_CLASS_PUBLIC
public static final int TYPE_CLASS_PUBLIC
- See Also:
- Constant Field Values
TYPE_CLASS_PUBLIC_STATIC
public static final int TYPE_CLASS_PUBLIC_STATIC
- See Also:
- Constant Field Values
TYPE_CONSTRUCTOR
public static final int[] TYPE_CONSTRUCTOR
TYPE_CONSTRUCTOR_PRIVATE
public static final int TYPE_CONSTRUCTOR_PRIVATE
- See Also:
- Constant Field Values
TYPE_CONSTRUCTOR_PROTECTED
public static final int TYPE_CONSTRUCTOR_PROTECTED
- See Also:
- Constant Field Values
TYPE_CONSTRUCTOR_PUBLIC
public static final int TYPE_CONSTRUCTOR_PUBLIC
- See Also:
- Constant Field Values
TYPE_METHOD
public static final int[] TYPE_METHOD
TYPE_METHOD_PRIVATE
public static final int TYPE_METHOD_PRIVATE
- See Also:
- Constant Field Values
TYPE_METHOD_PRIVATE_STATIC
public static final int TYPE_METHOD_PRIVATE_STATIC
- See Also:
- Constant Field Values
TYPE_METHOD_PROTECTED
public static final int TYPE_METHOD_PROTECTED
- See Also:
- Constant Field Values
TYPE_METHOD_PROTECTED_STATIC
public static final int TYPE_METHOD_PROTECTED_STATIC
- See Also:
- Constant Field Values
TYPE_METHOD_PUBLIC
public static final int TYPE_METHOD_PUBLIC
- See Also:
- Constant Field Values
TYPE_METHOD_PUBLIC_STATIC
public static final int TYPE_METHOD_PUBLIC_STATIC
- See Also:
- Constant Field Values
TYPE_VARIABLE
public static final int[] TYPE_VARIABLE
TYPE_VARIABLE_PRIVATE
public static final int TYPE_VARIABLE_PRIVATE
- See Also:
- Constant Field Values
TYPE_VARIABLE_PRIVATE_STATIC
public static final int TYPE_VARIABLE_PRIVATE_STATIC
- See Also:
- Constant Field Values
TYPE_VARIABLE_PRIVATE_STATIC_FINAL
public static final int TYPE_VARIABLE_PRIVATE_STATIC_FINAL
- See Also:
- Constant Field Values
TYPE_VARIABLE_PROTECTED
public static final int TYPE_VARIABLE_PROTECTED
- See Also:
- Constant Field Values
TYPE_VARIABLE_PROTECTED_STATIC
public static final int TYPE_VARIABLE_PROTECTED_STATIC
- See Also:
- Constant Field Values
TYPE_VARIABLE_PROTECTED_STATIC_FINAL
public static final int TYPE_VARIABLE_PROTECTED_STATIC_FINAL
- See Also:
- Constant Field Values
TYPE_VARIABLE_PUBLIC
public static final int TYPE_VARIABLE_PUBLIC
- See Also:
- Constant Field Values
TYPE_VARIABLE_PUBLIC_STATIC
public static final int TYPE_VARIABLE_PUBLIC_STATIC
- See Also:
- Constant Field Values
TYPE_VARIABLE_PUBLIC_STATIC_FINAL
public static final int TYPE_VARIABLE_PUBLIC_STATIC_FINAL
- See Also:
- Constant Field Values
JavaSourceProcessor
public JavaSourceProcessor()
stripJavaImports
public static String stripJavaImports(String content,
String packageDir,
String className)
throws IOException
- Throws:
IOException
isInJavaTermTypeGroup
protected static boolean isInJavaTermTypeGroup(int javaTermType,
int[] javaTermTypeGroup)
addParameterTypes
protected List<String> addParameterTypes(String line,
List<String> parameterTypes)
checkAnnotationForMethod
protected void checkAnnotationForMethod(JavaTerm javaTerm,
String annotation,
String requiredMethodNameRegex,
int requiredMethodType,
String fileName)
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)
checkTestAnnotations
protected void checkTestAnnotations(JavaTerm javaTerm,
String fileName)
checkUnprocessedExceptions
protected void checkUnprocessedExceptions(String content,
File file,
String packagePath,
String fileName)
throws IOException
- Throws:
IOException
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)
fixJavaTermsDividers
protected String fixJavaTermsDividers(String fileName,
String content,
Set<JavaTerm> javaTerms)
format
protected void format()
throws Exception
- Specified by:
format
in class BaseSourceProcessor
- Throws:
Exception
format
protected String format(String fileName)
throws Exception
- Overrides:
format
in class BaseSourceProcessor
- Throws:
Exception
formatAnnotations
protected String formatAnnotations(String fileName,
String content,
Set<JavaTerm> javaTerms)
throws IOException
- Throws:
IOException
formatJava
protected String formatJava(String fileName,
String content)
throws IOException
- Throws:
IOException
getClassName
protected String getClassName(String line)
getCombinedLines
protected Tuple getCombinedLines(String line,
String previousLine,
int lineTabCount,
int previousLineTabCount)
getConstructorOrMethodName
protected String getConstructorOrMethodName(String line,
int pos)
getImportedExceptionClassNames
protected List<String> getImportedExceptionClassNames(com.thoughtworks.qdox.JavaDocBuilder javaDocBuilder)
getJavaTermTuple
protected Tuple getJavaTermTuple(String line,
String content,
int index,
int numLines,
int maxLines)
getLeadingTabCount
protected int getLeadingTabCount(String line)
getLineLength
protected int getLineLength(String line)
getPluginJavaFiles
protected Collection<String> getPluginJavaFiles()
getPortalJavaFiles
protected Collection<String> getPortalJavaFiles()
getVariableName
protected String getVariableName(String line)
hasAnnotationCommentOrJavadoc
protected boolean hasAnnotationCommentOrJavadoc(String s)
isGenerated
protected boolean isGenerated(String content)
isValidJavaParameter
protected boolean isValidJavaParameter(String javaParameter)
sortExceptions
protected String sortExceptions(String line)
sortJavaTerms
protected String sortJavaTerms(String fileName,
String content,
Set<JavaTerm> javaTerms)