Liferay 7.0-ce-m2

com.liferay.portal.tools.sourceformatter
Class JavaClass

java.lang.Object
  extended by com.liferay.portal.tools.sourceformatter.JavaClass

public class JavaClass
extends Object


Field Summary
static int[] TYPE_CLASS
           
static int TYPE_CLASS_PRIVATE
           
static int TYPE_CLASS_PRIVATE_STATIC
           
static int TYPE_CLASS_PROTECTED
           
static int TYPE_CLASS_PROTECTED_STATIC
           
static int TYPE_CLASS_PUBLIC
           
static int TYPE_CLASS_PUBLIC_STATIC
           
static int[] TYPE_CONSTRUCTOR
           
static int TYPE_CONSTRUCTOR_PRIVATE
           
static int TYPE_CONSTRUCTOR_PROTECTED
           
static int TYPE_CONSTRUCTOR_PUBLIC
           
static int[] TYPE_METHOD
           
static int TYPE_METHOD_PRIVATE
           
static int TYPE_METHOD_PRIVATE_STATIC
           
static int TYPE_METHOD_PROTECTED
           
static int TYPE_METHOD_PROTECTED_STATIC
           
static int TYPE_METHOD_PUBLIC
           
static int TYPE_METHOD_PUBLIC_STATIC
           
static int TYPE_STATIC_BLOCK
           
static int[] TYPE_VARIABLE
           
static int TYPE_VARIABLE_PRIVATE
           
static int TYPE_VARIABLE_PRIVATE_STATIC
           
static int TYPE_VARIABLE_PROTECTED
           
static int TYPE_VARIABLE_PROTECTED_STATIC
           
static int TYPE_VARIABLE_PUBLIC
           
static int TYPE_VARIABLE_PUBLIC_STATIC
           
static int[] TYPE_VARIABLE_STATIC
           
 
Constructor Summary
JavaClass(String fileName, String absolutePath, String content, int lineCount, String indent)
           
 
Method Summary
protected  Set<JavaTerm> addStaticBlocks(Set<JavaTerm> javaTerms)
           
protected  void checkAnnotationForMethod(JavaTerm javaTerm, String annotation, String requiredMethodNameRegex, int requiredMethodType, String fileName)
           
protected  void checkTestAnnotations(JavaTerm javaTerm)
           
protected  void fixJavaTermsDividers(Set<JavaTerm> javaTerms, List<String> javaTermSortExclusions)
           
protected  String fixLeadingTabs(String content, String line, int expectedTabCount)
           
protected  void fixTabsAndIncorrectEmptyLines(JavaTerm javaTerm)
           
protected  void formatAnnotations(JavaTerm javaTerm, List<String> testAnnotationsExclusions)
           
 String formatJavaTerms(List<String> javaTermAccessLevelModifierExclusions, List<String> javaTermSortExclusions, List<String> testAnnotationsExclusions)
           
protected  String getClassName(String line)
           
protected  String getConstructorOrMethodName(String line, int pos)
           
protected  Set<JavaTerm> getJavaTerms(List<String> javaTermAccessLevelModifierExclusions)
           
protected  Tuple getJavaTermTuple(String line, String content, int index)
           
protected  String getVariableName(String line)
           
protected  boolean hasAnnotationCommentOrJavadoc(String s)
           
protected static boolean isInJavaTermTypeGroup(int javaTermType, int[] javaTermTypeGroup)
           
protected  boolean isValidJavaTerm(String content)
           
protected  void sortJavaTerms(JavaTerm previousJavaTerm, JavaTerm javaTerm, List<String> javaTermSortExclusions)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_CLASS

public static final int[] TYPE_CLASS

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_STATIC_BLOCK

public static final int TYPE_STATIC_BLOCK
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_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_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_STATIC

public static final int[] TYPE_VARIABLE_STATIC
Constructor Detail

JavaClass

public JavaClass(String fileName,
                 String absolutePath,
                 String content,
                 int lineCount,
                 String indent)
          throws Exception
Throws:
Exception
Method Detail

formatJavaTerms

public String formatJavaTerms(List<String> javaTermAccessLevelModifierExclusions,
                              List<String> javaTermSortExclusions,
                              List<String> testAnnotationsExclusions)
                       throws Exception
Throws:
Exception

isInJavaTermTypeGroup

protected static boolean isInJavaTermTypeGroup(int javaTermType,
                                               int[] javaTermTypeGroup)

addStaticBlocks

protected Set<JavaTerm> addStaticBlocks(Set<JavaTerm> javaTerms)

checkAnnotationForMethod

protected void checkAnnotationForMethod(JavaTerm javaTerm,
                                        String annotation,
                                        String requiredMethodNameRegex,
                                        int requiredMethodType,
                                        String fileName)

checkTestAnnotations

protected void checkTestAnnotations(JavaTerm javaTerm)

fixJavaTermsDividers

protected void fixJavaTermsDividers(Set<JavaTerm> javaTerms,
                                    List<String> javaTermSortExclusions)

fixLeadingTabs

protected String fixLeadingTabs(String content,
                                String line,
                                int expectedTabCount)

fixTabsAndIncorrectEmptyLines

protected void fixTabsAndIncorrectEmptyLines(JavaTerm javaTerm)

formatAnnotations

protected void formatAnnotations(JavaTerm javaTerm,
                                 List<String> testAnnotationsExclusions)
                          throws Exception
Throws:
Exception

getClassName

protected String getClassName(String line)

getConstructorOrMethodName

protected String getConstructorOrMethodName(String line,
                                            int pos)

getJavaTerms

protected Set<JavaTerm> getJavaTerms(List<String> javaTermAccessLevelModifierExclusions)
                              throws Exception
Throws:
Exception

getJavaTermTuple

protected Tuple getJavaTermTuple(String line,
                                 String content,
                                 int index)

getVariableName

protected String getVariableName(String line)

hasAnnotationCommentOrJavadoc

protected boolean hasAnnotationCommentOrJavadoc(String s)

isValidJavaTerm

protected boolean isValidJavaTerm(String content)

sortJavaTerms

protected void sortJavaTerms(JavaTerm previousJavaTerm,
                             JavaTerm javaTerm,
                             List<String> javaTermSortExclusions)

Liferay 7.0-ce-m2