com.liferay.portal.tools.sourceformatter
Class BaseSourceProcessor
java.lang.Object
com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
- All Implemented Interfaces:
- SourceProcessor
- Direct Known Subclasses:
- CSSSourceProcessor, FTLSourceProcessor, JavaSourceProcessor, JSPSourceProcessor, JSSourceProcessor, PropertiesSourceProcessor, SHSourceProcessor, SQLSourceProcessor, TLDSourceProcessor, XMLSourceProcessor
public abstract class BaseSourceProcessor
- extends Object
- implements SourceProcessor
Method Summary |
protected void |
checkIfClauseParentheses(String ifClause,
String fileName,
int lineCount)
|
protected void |
checkInefficientStringMethods(String line,
String fileName,
int lineCount)
|
protected void |
checkLanguageKeys(String fileName,
String content,
Pattern pattern)
|
protected void |
checkStringBundler(String line,
String fileName,
int lineCount)
|
protected String |
fixCompatClassImports(File file,
String content)
|
protected String |
fixCopyright(String content,
String copyright,
String oldCopyright,
File file,
String fileName)
|
protected String |
fixSessionKey(String fileName,
String content,
Pattern pattern)
|
protected abstract void |
format()
|
void |
format(boolean useProperties,
boolean printErrors,
boolean autoFix,
String mainReleaseVersion)
|
protected String |
format(String fileName)
|
String |
format(String fileName,
boolean useProperties,
boolean printErrors,
boolean autoFix,
String mainReleaseVersion)
|
protected static String |
formatImports(String imports,
int classStartPos)
|
protected Map<String,String> |
getCompatClassNamesMap()
|
protected String |
getCopyright()
|
protected String |
getCustomCopyright(File file)
|
List<String> |
getErrorMessages()
|
protected Properties |
getExclusionsProperties(String fileName)
|
protected List<String> |
getFileNames(String[] excludes,
String[] includes)
|
protected List<String> |
getFileNames(String basedir,
String[] excludes,
String[] includes)
|
protected String[] |
getLanguageKeys(Matcher matcher)
|
protected String |
getOldCopyright()
|
protected boolean |
hasMissingParentheses(String s)
|
protected boolean |
hasRedundantParentheses(String s)
|
protected boolean |
isAutoFix()
|
protected void |
processErrorMessage(String fileName,
String message)
|
protected String |
replacePrimitiveWrapperInstantiation(String fileName,
String line,
int lineCount)
|
protected String |
stripQuotes(String s,
char delimeter)
|
protected String |
stripRedundantParentheses(String s)
|
protected Properties |
stripTopLevelDirectories(Properties properties,
int level)
|
protected String |
trimContent(String content,
boolean allowLeadingSpaces)
|
protected String |
trimLine(String line,
boolean allowLeadingSpaces)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BASEDIR
protected static final String BASEDIR
- See Also:
- Constant Field Values
MAIN_RELEASE_VERSION_6_1_0
protected static final String MAIN_RELEASE_VERSION_6_1_0
- See Also:
- Constant Field Values
MAIN_RELEASE_VERSION_6_2_0
protected static final String MAIN_RELEASE_VERSION_6_2_0
- See Also:
- Constant Field Values
fileUtil
protected static FileImpl fileUtil
languageKeyPattern
protected static Pattern languageKeyPattern
mainReleaseVersion
protected static String mainReleaseVersion
portalSource
protected static boolean portalSource
saxReaderUtil
protected static SAXReaderImpl saxReaderUtil
sessionKeyPattern
protected static Pattern sessionKeyPattern
sourceFormatterHelper
protected static SourceFormatterHelper sourceFormatterHelper
taglibSessionKeyPattern
protected static Pattern taglibSessionKeyPattern
BaseSourceProcessor
public BaseSourceProcessor()
format
public void format(boolean useProperties,
boolean printErrors,
boolean autoFix,
String mainReleaseVersion)
throws Exception
- Specified by:
format
in interface SourceProcessor
- Throws:
Exception
format
public String format(String fileName,
boolean useProperties,
boolean printErrors,
boolean autoFix,
String mainReleaseVersion)
throws Exception
- Specified by:
format
in interface SourceProcessor
- Throws:
Exception
getErrorMessages
public List<String> getErrorMessages()
- Specified by:
getErrorMessages
in interface SourceProcessor
formatImports
protected static String formatImports(String imports,
int classStartPos)
throws IOException
- Throws:
IOException
checkIfClauseParentheses
protected void checkIfClauseParentheses(String ifClause,
String fileName,
int lineCount)
checkInefficientStringMethods
protected void checkInefficientStringMethods(String line,
String fileName,
int lineCount)
checkLanguageKeys
protected void checkLanguageKeys(String fileName,
String content,
Pattern pattern)
throws IOException
- Throws:
IOException
checkStringBundler
protected void checkStringBundler(String line,
String fileName,
int lineCount)
fixCompatClassImports
protected String fixCompatClassImports(File file,
String content)
throws IOException
- Throws:
IOException
fixCopyright
protected String fixCopyright(String content,
String copyright,
String oldCopyright,
File file,
String fileName)
throws IOException
- Throws:
IOException
fixSessionKey
protected String fixSessionKey(String fileName,
String content,
Pattern pattern)
format
protected abstract void format()
throws Exception
- Throws:
Exception
format
protected String format(String fileName)
throws Exception
- Throws:
Exception
getCompatClassNamesMap
protected Map<String,String> getCompatClassNamesMap()
throws IOException
- Throws:
IOException
getCopyright
protected String getCopyright()
throws IOException
- Throws:
IOException
getCustomCopyright
protected String getCustomCopyright(File file)
throws IOException
- Throws:
IOException
getExclusionsProperties
protected Properties getExclusionsProperties(String fileName)
throws IOException
- Throws:
IOException
getFileNames
protected List<String> getFileNames(String basedir,
String[] excludes,
String[] includes)
getFileNames
protected List<String> getFileNames(String[] excludes,
String[] includes)
getLanguageKeys
protected String[] getLanguageKeys(Matcher matcher)
getOldCopyright
protected String getOldCopyright()
throws IOException
- Throws:
IOException
hasMissingParentheses
protected boolean hasMissingParentheses(String s)
hasRedundantParentheses
protected boolean hasRedundantParentheses(String s)
isAutoFix
protected boolean isAutoFix()
processErrorMessage
protected void processErrorMessage(String fileName,
String message)
replacePrimitiveWrapperInstantiation
protected String replacePrimitiveWrapperInstantiation(String fileName,
String line,
int lineCount)
stripQuotes
protected String stripQuotes(String s,
char delimeter)
stripRedundantParentheses
protected String stripRedundantParentheses(String s)
stripTopLevelDirectories
protected Properties stripTopLevelDirectories(Properties properties,
int level)
throws IOException
- Throws:
IOException
trimContent
protected String trimContent(String content,
boolean allowLeadingSpaces)
throws IOException
- Throws:
IOException
trimLine
protected String trimLine(String line,
boolean allowLeadingSpaces)