public abstract class BaseSourceProcessor extends java.lang.Object implements SourceProcessor
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.regex.Pattern |
applyLangMergerPluginPattern |
protected static java.util.regex.Pattern |
attributeNamePattern |
protected static java.util.regex.Pattern |
bndContentDirPattern |
protected static java.util.regex.Pattern |
emptyCollectionPattern |
protected static java.util.regex.Pattern |
javaSourceInsideJSPTagPattern |
protected static java.util.regex.Pattern |
languageKeyPattern |
protected static java.util.regex.Pattern |
mergeLangPattern |
static int |
PORTAL_MAX_DIR_LEVEL |
protected static boolean |
portalSource |
protected static java.util.regex.Pattern |
principalExceptionPattern |
protected static java.util.regex.Pattern |
sessionKeyPattern |
protected static java.util.regex.Pattern |
singleLengthStringPattern |
protected SourceFormatterArgs |
sourceFormatterArgs |
protected static java.util.regex.Pattern |
stringUtilReplacePattern |
protected static java.util.regex.Pattern |
taglibSessionKeyPattern |
| Constructor and Description |
|---|
BaseSourceProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected static int |
adjustLevel(int level,
java.lang.String text,
java.lang.String s,
int diff) |
protected void |
checkChaining(java.lang.String line,
java.lang.String fileName,
int lineCount) |
protected void |
checkEmptyCollection(java.lang.String line,
java.lang.String fileName,
int lineCount) |
protected void |
checkIfClauseParentheses(java.lang.String ifClause,
java.lang.String fileName,
int lineCount) |
protected void |
checkInefficientStringMethods(java.lang.String line,
java.lang.String fileName,
java.lang.String absolutePath,
int lineCount) |
protected void |
checkLanguageKeys(java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content,
java.util.regex.Pattern pattern) |
protected java.lang.String |
checkPrincipalException(java.lang.String content) |
protected void |
checkPropertyUtils(java.lang.String fileName,
java.lang.String content) |
protected void |
checkResourceUtil(java.lang.String line,
java.lang.String fileName,
int lineCount) |
protected void |
checkStringBundler(java.lang.String line,
java.lang.String fileName,
int lineCount) |
protected void |
checkStringUtilReplace(java.lang.String fileName,
java.lang.String content) |
protected void |
checkUTF8(java.io.File file,
java.lang.String fileName) |
protected abstract java.lang.String |
doFormat(java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content) |
protected abstract java.util.List<java.lang.String> |
doGetFileNames() |
protected java.lang.String |
fixCompatClassImports(java.lang.String absolutePath,
java.lang.String content) |
protected java.lang.String |
fixCopyright(java.lang.String content,
java.lang.String absolutePath,
java.lang.String fileName) |
protected java.lang.String |
fixIncorrectParameterTypeForLanguageUtil(java.lang.String content,
boolean autoFix,
java.lang.String fileName) |
protected java.lang.String |
fixSessionKey(java.lang.String fileName,
java.lang.String content,
java.util.regex.Pattern pattern) |
void |
format() |
protected java.lang.String |
format(java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content) |
protected void |
format(java.lang.String fileName) |
protected java.lang.String |
formatEmptyArray(java.lang.String line) |
protected java.lang.String |
formatIncorrectSyntax(java.lang.String line,
java.lang.String incorrectSyntax,
java.lang.String correctSyntax,
boolean lineStart) |
protected java.lang.String |
formatJavaTerms(java.lang.String javaClassName,
java.lang.String packagePath,
java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content,
java.lang.String javaClassContent,
int javaClassLineCount,
java.util.List<java.lang.String> checkJavaFieldTypesExcludes,
java.util.List<java.lang.String> javaTermAccessLevelModifierExcludes,
java.util.List<java.lang.String> javaTermSortExcludes,
java.util.List<java.lang.String> testAnnotationsExcludes) |
protected java.lang.String |
formatTagAttributeType(java.lang.String line,
java.lang.String tag,
java.lang.String attributeAndValue) |
protected java.lang.String |
formatWhitespace(java.lang.String line,
boolean javaSource) |
protected java.lang.String |
formatWhitespace(java.lang.String line,
java.lang.String linePart,
boolean javaSource) |
protected java.lang.String |
getAbsolutePath(java.io.File file) |
protected java.util.Set<java.lang.String> |
getAnnotationsExclusions() |
protected java.util.Properties |
getBNDFileLanguageProperties(java.lang.String fileName) |
protected com.liferay.portal.kernel.util.Tuple |
getBNDFileLocationAndContentTuple(java.lang.String fileName) |
protected java.util.Map<java.lang.String,java.lang.String> |
getCompatClassNamesMap() |
protected java.lang.String |
getContent(java.lang.String fileName,
int level) |
protected java.lang.String |
getCustomCopyright(java.lang.String absolutePath) |
java.util.List<java.lang.String> |
getErrorMessages() |
protected java.io.File |
getFile(java.lang.String fileName,
int level) |
java.util.List<java.lang.String> |
getFileNames() |
protected java.util.List<java.lang.String> |
getFileNames(java.lang.String[] excludes,
java.lang.String[] includes) |
protected java.util.List<java.lang.String> |
getFileNames(java.lang.String basedir,
java.util.List<java.lang.String> recentChangesFileNames,
java.lang.String[] excludes,
java.lang.String[] includes) |
protected java.util.List<java.lang.String> |
getFileNames(java.lang.String basedir,
java.lang.String[] excludes,
java.lang.String[] includes) |
SourceMismatchException |
getFirstSourceMismatchException() |
protected java.util.Set<java.lang.String> |
getImmutableFieldTypes() |
protected java.lang.String[] |
getLanguageKeys(java.util.regex.Matcher matcher) |
protected static int |
getLeadingTabCount(java.lang.String line) |
protected static int |
getLevel(java.lang.String s) |
protected static int |
getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings) |
protected static int |
getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings,
int startLevel) |
protected static int |
getLevel(java.lang.String s,
java.lang.String increaseLevelString,
java.lang.String decreaseLevelString) |
protected int |
getLineCount(java.lang.String content,
int pos) |
protected int |
getLineLength(java.lang.String line) |
protected java.lang.String |
getMainReleaseVersion() |
java.util.List<java.lang.String> |
getModifiedFileNames() |
protected java.util.List<java.lang.String> |
getModuleLangDirNames(java.lang.String moduleLocation,
java.lang.String buildGradleContent) |
protected java.util.Properties |
getModuleLangLanguageProperties(java.lang.String absolutePath) |
protected java.util.Properties |
getModuleLanguageProperties(java.lang.String fileName) |
protected java.lang.String |
getProperty(java.lang.String key) |
protected java.util.List<java.lang.String> |
getPropertyList(java.lang.String key) |
protected java.util.List<java.lang.String> |
getRunOutsidePortalExcludes() |
protected boolean |
hasMissingParentheses(java.lang.String s) |
protected boolean |
hasRedundantParentheses(java.lang.String s) |
protected boolean |
hasRedundantParentheses(java.lang.String s,
java.lang.String operator1,
java.lang.String operator2) |
protected boolean |
isAttributName(java.lang.String attributeName) |
protected static boolean |
isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path) |
protected static boolean |
isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount) |
protected static boolean |
isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount,
java.lang.String javaTermName) |
protected boolean |
isModulesFile(java.lang.String absolutePath) |
protected void |
postFormat() |
protected void |
printError(java.lang.String fileName,
java.lang.String message) |
protected void |
processErrorMessage(java.lang.String fileName,
java.lang.String message) |
protected void |
processFormattedFile(java.io.File file,
java.lang.String fileName,
java.lang.String content,
java.lang.String newContent) |
protected java.lang.String |
replacePrimitiveWrapperInstantiation(java.lang.String line) |
void |
setSourceFormatterArgs(SourceFormatterArgs sourceFormatterArgs) |
protected java.lang.String |
sortAttributes(java.lang.String fileName,
java.lang.String line,
int lineCount,
boolean allowApostropheDelimeter) |
protected java.lang.String |
sortHTMLAttributes(java.lang.String line,
java.lang.String value,
java.lang.String attributeAndValue) |
protected static java.lang.String |
stripQuotes(java.lang.String s) |
protected static java.lang.String |
stripQuotes(java.lang.String s,
char... delimeters) |
protected java.lang.String |
stripRedundantParentheses(java.lang.String s) |
protected java.lang.String |
trimContent(java.lang.String content,
boolean allowLeadingSpaces) |
protected java.lang.String |
trimLine(java.lang.String line,
boolean allowLeadingSpaces) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIncludespublic static final int PORTAL_MAX_DIR_LEVEL
protected static java.util.regex.Pattern applyLangMergerPluginPattern
protected static java.util.regex.Pattern attributeNamePattern
protected static java.util.regex.Pattern bndContentDirPattern
protected static java.util.regex.Pattern emptyCollectionPattern
protected static java.util.regex.Pattern javaSourceInsideJSPTagPattern
protected static java.util.regex.Pattern languageKeyPattern
protected static java.util.regex.Pattern mergeLangPattern
protected static boolean portalSource
protected static java.util.regex.Pattern principalExceptionPattern
protected static java.util.regex.Pattern sessionKeyPattern
protected static java.util.regex.Pattern singleLengthStringPattern
protected static java.util.regex.Pattern stringUtilReplacePattern
protected static java.util.regex.Pattern taglibSessionKeyPattern
protected SourceFormatterArgs sourceFormatterArgs
public final void format()
throws java.lang.Exception
format in interface SourceProcessorjava.lang.Exceptionpublic java.util.List<java.lang.String> getErrorMessages()
getErrorMessages in interface SourceProcessorpublic final java.util.List<java.lang.String> getFileNames()
throws java.lang.Exception
java.lang.Exceptionpublic SourceMismatchException getFirstSourceMismatchException()
getFirstSourceMismatchException in interface SourceProcessorpublic java.util.List<java.lang.String> getModifiedFileNames()
getModifiedFileNames in interface SourceProcessorpublic void setSourceFormatterArgs(SourceFormatterArgs sourceFormatterArgs)
setSourceFormatterArgs in interface SourceProcessorprotected static int adjustLevel(int level,
java.lang.String text,
java.lang.String s,
int diff)
protected static int getLeadingTabCount(java.lang.String line)
protected static int getLevel(java.lang.String s)
protected static int getLevel(java.lang.String s,
java.lang.String increaseLevelString,
java.lang.String decreaseLevelString)
protected static int getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings)
protected static int getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings,
int startLevel)
protected static boolean isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path)
protected static boolean isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount)
protected static boolean isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount,
java.lang.String javaTermName)
protected static java.lang.String stripQuotes(java.lang.String s)
protected static java.lang.String stripQuotes(java.lang.String s,
char... delimeters)
protected void checkChaining(java.lang.String line,
java.lang.String fileName,
int lineCount)
protected void checkEmptyCollection(java.lang.String line,
java.lang.String fileName,
int lineCount)
protected void checkIfClauseParentheses(java.lang.String ifClause,
java.lang.String fileName,
int lineCount)
protected void checkInefficientStringMethods(java.lang.String line,
java.lang.String fileName,
java.lang.String absolutePath,
int lineCount)
protected void checkLanguageKeys(java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content,
java.util.regex.Pattern pattern)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String checkPrincipalException(java.lang.String content)
protected void checkPropertyUtils(java.lang.String fileName,
java.lang.String content)
protected void checkResourceUtil(java.lang.String line,
java.lang.String fileName,
int lineCount)
protected void checkStringBundler(java.lang.String line,
java.lang.String fileName,
int lineCount)
protected void checkStringUtilReplace(java.lang.String fileName,
java.lang.String content)
throws java.lang.Exception
java.lang.Exceptionprotected void checkUTF8(java.io.File file,
java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionprotected abstract java.lang.String doFormat(java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content)
throws java.lang.Exception
java.lang.Exceptionprotected abstract java.util.List<java.lang.String> doGetFileNames()
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String fixCompatClassImports(java.lang.String absolutePath,
java.lang.String content)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String fixCopyright(java.lang.String content,
java.lang.String absolutePath,
java.lang.String fileName)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String fixIncorrectParameterTypeForLanguageUtil(java.lang.String content,
boolean autoFix,
java.lang.String fileName)
protected java.lang.String fixSessionKey(java.lang.String fileName,
java.lang.String content,
java.util.regex.Pattern pattern)
protected final java.lang.String format(java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content)
throws java.lang.Exception
java.lang.Exceptionprotected final void format(java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String formatEmptyArray(java.lang.String line)
protected java.lang.String formatIncorrectSyntax(java.lang.String line,
java.lang.String incorrectSyntax,
java.lang.String correctSyntax,
boolean lineStart)
protected java.lang.String formatJavaTerms(java.lang.String javaClassName,
java.lang.String packagePath,
java.io.File file,
java.lang.String fileName,
java.lang.String absolutePath,
java.lang.String content,
java.lang.String javaClassContent,
int javaClassLineCount,
java.util.List<java.lang.String> checkJavaFieldTypesExcludes,
java.util.List<java.lang.String> javaTermAccessLevelModifierExcludes,
java.util.List<java.lang.String> javaTermSortExcludes,
java.util.List<java.lang.String> testAnnotationsExcludes)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String formatTagAttributeType(java.lang.String line,
java.lang.String tag,
java.lang.String attributeAndValue)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String formatWhitespace(java.lang.String line,
boolean javaSource)
protected java.lang.String formatWhitespace(java.lang.String line,
java.lang.String linePart,
boolean javaSource)
protected java.lang.String getAbsolutePath(java.io.File file)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.Set<java.lang.String> getAnnotationsExclusions()
protected java.util.Properties getBNDFileLanguageProperties(java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionprotected com.liferay.portal.kernel.util.Tuple getBNDFileLocationAndContentTuple(java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.Map<java.lang.String,java.lang.String> getCompatClassNamesMap()
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String getContent(java.lang.String fileName,
int level)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getCustomCopyright(java.lang.String absolutePath)
throws java.io.IOException
java.io.IOExceptionprotected java.io.File getFile(java.lang.String fileName,
int level)
protected java.util.List<java.lang.String> getFileNames(java.lang.String basedir,
java.util.List<java.lang.String> recentChangesFileNames,
java.lang.String[] excludes,
java.lang.String[] includes)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.List<java.lang.String> getFileNames(java.lang.String basedir,
java.lang.String[] excludes,
java.lang.String[] includes)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.List<java.lang.String> getFileNames(java.lang.String[] excludes,
java.lang.String[] includes)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.Set<java.lang.String> getImmutableFieldTypes()
protected java.lang.String[] getLanguageKeys(java.util.regex.Matcher matcher)
protected int getLineCount(java.lang.String content,
int pos)
protected int getLineLength(java.lang.String line)
protected java.lang.String getMainReleaseVersion()
protected java.util.List<java.lang.String> getModuleLangDirNames(java.lang.String moduleLocation,
java.lang.String buildGradleContent)
protected java.util.Properties getModuleLangLanguageProperties(java.lang.String absolutePath)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.Properties getModuleLanguageProperties(java.lang.String fileName)
protected java.lang.String getProperty(java.lang.String key)
protected java.util.List<java.lang.String> getPropertyList(java.lang.String key)
protected java.util.List<java.lang.String> getRunOutsidePortalExcludes()
protected boolean hasMissingParentheses(java.lang.String s)
protected boolean hasRedundantParentheses(java.lang.String s)
protected boolean hasRedundantParentheses(java.lang.String s,
java.lang.String operator1,
java.lang.String operator2)
protected boolean isAttributName(java.lang.String attributeName)
protected boolean isModulesFile(java.lang.String absolutePath)
protected void postFormat()
throws java.lang.Exception
java.lang.Exceptionprotected void printError(java.lang.String fileName,
java.lang.String message)
protected void processErrorMessage(java.lang.String fileName,
java.lang.String message)
protected void processFormattedFile(java.io.File file,
java.lang.String fileName,
java.lang.String content,
java.lang.String newContent)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String replacePrimitiveWrapperInstantiation(java.lang.String line)
protected java.lang.String sortAttributes(java.lang.String fileName,
java.lang.String line,
int lineCount,
boolean allowApostropheDelimeter)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String sortHTMLAttributes(java.lang.String line,
java.lang.String value,
java.lang.String attributeAndValue)
protected java.lang.String stripRedundantParentheses(java.lang.String s)
protected java.lang.String trimContent(java.lang.String content,
boolean allowLeadingSpaces)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String trimLine(java.lang.String line,
boolean allowLeadingSpaces)