|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.CodeFormat
public final class CodeFormat
Encapsulates some common Java source code formatting options. The class can also be used as a buffer for formatted Java code.
Constructor Summary | |
---|---|
CodeFormat()
|
Method Summary | |
---|---|
CodeFormat |
afterSection()
Append the given value to the internal buffer. |
CodeFormat |
append(boolean val)
Append the given value to the internal buffer. |
CodeFormat |
append(byte val)
Append the given value to the internal buffer. |
CodeFormat |
append(char val)
Append the given value to the internal buffer. |
CodeFormat |
append(double val)
Append the given value to the internal buffer. |
CodeFormat |
append(float val)
Append the given value to the internal buffer. |
CodeFormat |
append(int val)
Append the given value to the internal buffer. |
CodeFormat |
append(long val)
Append the given value to the internal buffer. |
CodeFormat |
append(Object val)
Append the given value to the internal buffer. |
CodeFormat |
append(short val)
Append the given value to the internal buffer. |
void |
clear()
Clear the internal code buffer. |
Object |
clone()
Make a copy of this code format object with all the same formatting settings. |
CodeFormat |
closeBrace(int tabLevel)
Append the given value to the internal buffer. |
CodeFormat |
closeParen()
Append the given value to the internal buffer. |
CodeFormat |
endl()
Append the given value to the internal buffer. |
CodeFormat |
endl(int num)
Append the given value to the internal buffer. |
CodeFormat |
endl(int num,
int tabs)
Append the given value to the internal buffer. |
CodeFormat |
extendsDec(int tabLevel)
Append the given value to the internal buffer. |
CodeFormat |
fieldName(String name)
Append the given value to the internal buffer. |
String |
getAfterSection()
Return {#getLinesBetweenSections} + 1 new line characters. |
boolean |
getBraceAtSameTabLevel()
Whether to place braces at the same tab level as the code within the block. |
boolean |
getBraceOnSameLine()
Whether to place opening braces on the same line as the block declaration, or on the next line. |
StringBuffer |
getBuffer()
Return the internal code buffer. |
String |
getCloseBrace(int tabLevel)
Close brace string. |
String |
getCloseParen()
Close parentheses string. |
String |
getEndl()
Return a new line character. |
String |
getEndl(int num)
Return the given number of new line characters. |
String |
getEndl(int num,
int tabs)
Return the given number of new line characters, followed by the given tab level indentation. |
String |
getExtendsDec(int tabLevel)
Extends declaration. |
String |
getFieldName(String fieldName)
Return the field name for given suggested name, possibly adding leading underscore. |
String |
getImplementsDec(int tabLevel)
Implements declaration. |
int |
getLinesBetweenSections()
The number of empty lines between code sections. |
String |
getOpenBrace(int tabLevel)
Open brace string. |
String |
getOpenParen(boolean methodOrIf)
Open parentheses string. |
String |
getParens()
Paired parentheses for empty method parameters. |
boolean |
getScoreBeforeFieldName()
Whether to place an underscore before private field names. |
boolean |
getSpaceBeforeParen()
Whether to place a space before parentheses. |
boolean |
getSpaceInParen()
Whether to place a space within parentheses. |
String |
getTab()
Tab string. |
String |
getTab(int tabLevel)
Tab string. |
int |
getTabSpaces()
The number of spaces to use for tabs; 0 means to use actual tab characters. |
String |
getThrowsDec(int tabLevel)
Throws declaration. |
CodeFormat |
implementsDec(int tabLevel)
Append the given value to the internal buffer. |
int |
length()
Return the length of the internal buffer. |
CodeFormat |
openBrace(int tabLevel)
Append the given value to the internal buffer. |
CodeFormat |
openParen(boolean methodOrIf)
Append the given value to the internal buffer. |
CodeFormat |
parens()
Append the given value to the internal buffer. |
void |
setBraceAtSameTabLevel(boolean braceAtSameTabLevel)
Whether to place braces at the same tab level as the code within the block. |
void |
setBraceOnSameLine(boolean braceOnSameLine)
Whether to place opening braces on the same line as the block declaration, or on the next line. |
void |
setLinesBetweenSections(int linesBetweenSections)
The number of empty lines between sections. |
void |
setScoreBeforeFieldName(boolean scoreBeforeFieldName)
Whether to place an underscore before private field names. |
void |
setSpaceBeforeParen(boolean spaceBeforeParen)
Whether to place a space before parentheses. |
void |
setSpaceInParen(boolean spaceInParen)
Whether to place a space within parentheses. |
void |
setTabSpaces(int tab)
The number of spaces to use for tabs; 0 means to use actual tab characters. |
CodeFormat |
tab()
Append the given value to the internal buffer. |
CodeFormat |
tab(int tabLevel)
Append the given value to the internal buffer. |
CodeFormat |
throwsDec(int tabLevel)
Append the given value to the internal buffer. |
String |
toString()
Return the internal buffer as a string. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CodeFormat()
Method Detail |
---|
public int getTabSpaces()
public void setTabSpaces(int tab)
public boolean getSpaceBeforeParen()
public void setSpaceBeforeParen(boolean spaceBeforeParen)
public boolean getSpaceInParen()
public void setSpaceInParen(boolean spaceInParen)
public boolean getBraceOnSameLine()
public void setBraceOnSameLine(boolean braceOnSameLine)
public boolean getBraceAtSameTabLevel()
public void setBraceAtSameTabLevel(boolean braceAtSameTabLevel)
public boolean getScoreBeforeFieldName()
public void setScoreBeforeFieldName(boolean scoreBeforeFieldName)
public int getLinesBetweenSections()
public void setLinesBetweenSections(int linesBetweenSections)
public String getEndl()
public String getEndl(int num)
public String getEndl(int num, int tabs)
public String getAfterSection()
public String getOpenParen(boolean methodOrIf)
public String getCloseParen()
public String getParens()
public String getOpenBrace(int tabLevel)
tabLevel
- the tab level of code within the bracepublic String getCloseBrace(int tabLevel)
tabLevel
- the tab level of code within the bracepublic String getExtendsDec(int tabLevel)
openBrace(int)
,
but prints "extends" instead of a brace.
public String getImplementsDec(int tabLevel)
openBrace(int)
,
but prints "implements" instead of a brace.
public String getThrowsDec(int tabLevel)
openBrace(int)
,
but prints "throws" instead of a brace.
public String getTab()
public String getTab(int tabLevel)
tabLevel
- the number of tabspublic String getFieldName(String fieldName)
public StringBuffer getBuffer()
public CodeFormat append(boolean val)
public CodeFormat append(byte val)
public CodeFormat append(char val)
public CodeFormat append(double val)
public CodeFormat append(float val)
public CodeFormat append(int val)
public CodeFormat append(long val)
public CodeFormat append(short val)
public CodeFormat append(Object val)
public CodeFormat endl()
getEndl()
public CodeFormat endl(int num)
getEndl(int)
public CodeFormat endl(int num, int tabs)
getEndl(int, int)
public CodeFormat afterSection()
getAfterSection()
public CodeFormat openParen(boolean methodOrIf)
getOpenParen(boolean)
public CodeFormat closeParen()
getCloseParen()
public CodeFormat parens()
getParens()
public CodeFormat openBrace(int tabLevel)
getOpenBrace(int)
public CodeFormat closeBrace(int tabLevel)
getCloseBrace(int)
public CodeFormat extendsDec(int tabLevel)
getExtendsDec(int)
public CodeFormat implementsDec(int tabLevel)
getImplementsDec(int)
public CodeFormat throwsDec(int tabLevel)
getThrowsDec(int)
public CodeFormat tab()
getTab()
public CodeFormat tab(int tabLevel)
getTab()
public CodeFormat fieldName(String name)
getFieldName(java.lang.String)
public void clear()
public String toString()
toString
in class Object
public int length()
public Object clone()
clone
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |