com.liferay.portal.tools.sourceformatter
Class BaseSourceProcessor
java.lang.Object
com.liferay.portal.tools.sourceformatter.BaseSourceProcessor
- All Implemented Interfaces:
- SourceProcessor
- Direct Known Subclasses:
- 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 |
checkLanguageKeys(String fileName,
String content,
Pattern pattern)
|
protected abstract void |
doFormat()
|
protected String |
fixCompatClassImports(String fileName,
String content)
|
protected String |
fixCopyright(String content,
String copyright,
String oldCopyright,
File file,
String fileName)
|
protected String |
fixSessionKey(String fileName,
String content,
Pattern pattern)
|
void |
format(boolean useProperties,
boolean throwException)
|
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 void |
processErrorMessage(String fileName,
String message)
|
protected String |
replacePrimitiveWrapperInstantiation(String fileName,
String line,
int lineCount)
|
protected String |
stripQuotes(String s,
String 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 throwException)
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)
checkLanguageKeys
protected void checkLanguageKeys(String fileName,
String content,
Pattern pattern)
throws IOException
- Throws:
IOException
doFormat
protected abstract void doFormat()
throws Exception
- Throws:
Exception
fixCompatClassImports
protected String fixCompatClassImports(String fileName,
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)
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
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
getExclusionsProperties
protected Properties getExclusionsProperties(String fileName)
throws IOException
- Throws:
IOException
hasMissingParentheses
protected boolean hasMissingParentheses(String s)
hasRedundantParentheses
protected boolean hasRedundantParentheses(String s)
processErrorMessage
protected void processErrorMessage(String fileName,
String message)
replacePrimitiveWrapperInstantiation
protected String replacePrimitiveWrapperInstantiation(String fileName,
String line,
int lineCount)
stripQuotes
protected String stripQuotes(String s,
String 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)