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 |
getterUtilGetPattern |
protected static java.util.regex.Pattern |
javaSourceInsideJSPTagPattern |
protected static java.util.regex.Pattern |
jsonObjectPutBlockPattern |
protected static java.util.regex.Pattern |
jsonObjectPutPattern |
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 |
sbAppendPattern |
protected static java.util.regex.Pattern |
sbAppendWithStartingSpacePattern |
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 |
protected static java.util.regex.Pattern |
validatorEqualsPattern |
| Constructor and Description |
|---|
BaseSourceProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
adjustLevel(int level,
java.lang.String text,
java.lang.String s,
int diff) |
protected void |
checkEmptyCollection(java.lang.String line,
java.lang.String fileName,
int lineCount) |
protected void |
checkGetterUtilGet(java.lang.String fileName,
java.lang.String content) |
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 void |
checkOrder(java.lang.String fileName,
org.dom4j.Element rootElement,
java.lang.String elementName,
java.lang.String parentElementName,
ElementComparator elementComparator) |
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 |
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,
java.lang.String className) |
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 |
formatAttributes(java.lang.String fileName,
java.lang.String line,
java.lang.String tag,
int lineCount,
boolean escapeQuotes) |
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.lang.String indent,
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 |
formatJSONObject(java.lang.String content) |
protected java.lang.String |
formatStringBundler(java.lang.String fileName,
java.lang.String content,
int maxLineLength) |
protected java.lang.String |
formatTagAttributeType(java.lang.String line,
java.lang.String tagName,
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 int |
getLeadingTabCount(java.lang.String line) |
protected int |
getLevel(java.lang.String s) |
protected int |
getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings) |
protected int |
getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings,
int startLevel) |
protected int |
getLevel(java.lang.String s,
java.lang.String increaseLevelString,
java.lang.String decreaseLevelString) |
protected java.lang.String |
getLine(java.lang.String content,
int lineCount) |
protected int |
getLineCount(java.lang.String content,
int pos) |
protected int |
getLineLength(java.lang.String line) |
protected int |
getLineStartPos(java.lang.String content,
int lineCount) |
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.util.List<java.lang.String> |
getParameterList(java.util.regex.Matcher methodCallMatcher) |
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 |
isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path) |
protected boolean |
isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount) |
protected 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 |
preFormat() |
protected void |
printError(java.lang.String fileName,
java.lang.String message) |
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 org.dom4j.Document |
readXML(java.lang.String content) |
protected java.lang.String |
replacePrimitiveWrapperInstantiation(java.lang.String line) |
void |
setSourceFormatterArgs(SourceFormatterArgs sourceFormatterArgs) |
protected java.lang.String |
sortHTMLAttributes(java.lang.String line,
java.lang.String value,
java.lang.String attributeAndValue) |
protected java.util.List<java.lang.String> |
splitParameters(java.lang.String parameters) |
protected java.lang.String |
stripQuotes(java.lang.String s) |
protected 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 getterUtilGetPattern
protected static java.util.regex.Pattern javaSourceInsideJSPTagPattern
protected static java.util.regex.Pattern jsonObjectPutBlockPattern
protected static java.util.regex.Pattern jsonObjectPutPattern
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 sbAppendPattern
protected static java.util.regex.Pattern sbAppendWithStartingSpacePattern
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 static java.util.regex.Pattern validatorEqualsPattern
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 processErrorMessage(java.lang.String fileName,
java.lang.String message)
processErrorMessage in interface SourceProcessorpublic void setSourceFormatterArgs(SourceFormatterArgs sourceFormatterArgs)
setSourceFormatterArgs in interface SourceProcessorprotected int adjustLevel(int level,
java.lang.String text,
java.lang.String s,
int diff)
protected void checkEmptyCollection(java.lang.String line,
java.lang.String fileName,
int lineCount)
protected void checkGetterUtilGet(java.lang.String fileName,
java.lang.String content)
throws java.lang.Exception
java.lang.Exceptionprotected 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 void checkOrder(java.lang.String fileName,
org.dom4j.Element rootElement,
java.lang.String elementName,
java.lang.String parentElementName,
ElementComparator elementComparator)
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 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,
java.lang.String className)
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 formatAttributes(java.lang.String fileName,
java.lang.String line,
java.lang.String tag,
int lineCount,
boolean escapeQuotes)
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.lang.String indent,
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 formatJSONObject(java.lang.String content)
protected java.lang.String formatStringBundler(java.lang.String fileName,
java.lang.String content,
int maxLineLength)
protected java.lang.String formatTagAttributeType(java.lang.String line,
java.lang.String tagName,
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 getLeadingTabCount(java.lang.String line)
protected int getLevel(java.lang.String s)
protected int getLevel(java.lang.String s,
java.lang.String increaseLevelString,
java.lang.String decreaseLevelString)
protected int getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings)
protected int getLevel(java.lang.String s,
java.lang.String[] increaseLevelStrings,
java.lang.String[] decreaseLevelStrings,
int startLevel)
protected java.lang.String getLine(java.lang.String content,
int lineCount)
protected int getLineCount(java.lang.String content,
int pos)
protected int getLineLength(java.lang.String line)
protected int getLineStartPos(java.lang.String content,
int lineCount)
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.util.List<java.lang.String> getParameterList(java.util.regex.Matcher methodCallMatcher)
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 isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path)
protected boolean isExcludedPath(java.util.List<java.lang.String> excludes,
java.lang.String path,
int lineCount)
protected 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()
throws java.lang.Exception
java.lang.Exceptionprotected void preFormat()
throws java.lang.Exception
java.lang.Exceptionprotected void printError(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 org.dom4j.Document readXML(java.lang.String content)
throws org.dom4j.DocumentException
org.dom4j.DocumentExceptionprotected java.lang.String replacePrimitiveWrapperInstantiation(java.lang.String line)
protected java.lang.String sortHTMLAttributes(java.lang.String line,
java.lang.String value,
java.lang.String attributeAndValue)
protected java.util.List<java.lang.String> splitParameters(java.lang.String parameters)
protected java.lang.String stripQuotes(java.lang.String s)
protected 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)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String trimLine(java.lang.String line,
boolean allowLeadingSpaces)