Class DFormattingContext
java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.ir.DFormattingContext
dexdec IR formatting context, providing an output sink and specifications for the output.
Plugin codes may want to use a formatting context to generate and customize rendering of the IR.
In most cases, the writing methods like append(), space(), etc. will not be
needed by plugins.-
Constructor Summary
ConstructorsConstructorDescriptionCreate a default formatting context.Create a default formatting context. -
Method Summary
Modifier and TypeMethodDescriptionvoidangle()Convenience method to append an opening angle bracket (less-than sign) to this sink.voidConvenience method to append a closing angle bracket (greater-than sign) to this sink.append(char c) Append a character to this sink.append(int i) Append an integer in base 10 to this sink.Append the string representation of an object to this sink.Append a string to this sink.appendFormat(String format, Object... args) Append a formatted string to this sink.voidappendFormattedType(IJavaType type) Append a type to this sink.voidAppend a type to this sink if types are to be rendered (seeisDisplayTypes()).voidbrace()Convenience method to append an opening brace to this sink.voidConvenience method to append a closing brace to this sink.voidbracket()Convenience method to append an opening bracket to this sink.voidConvenience method to append a closing bracket to this sink.Retrieve the method context used during formatting.booleanDetermine whether may-throw markers should be displayed.booleanDetermine whether types should be displayed.booleanDetermine whether preferred names should be used when formatting.voidparen()Convenience method to append an opening parenthesis to this sink.voidConvenience method to append a closing parenthesis to this sink.voidsetDisplayCanThrow(boolean displayCanThrow) Set whether may-throw markers should be displayed.voidsetDisplayTypes(boolean displayTypes) Set whether types should be displayed.voidSet the method context used during formatting.voidsetUsePreferredNames(boolean usePreferredNames) Set whether preferred names should be used when formatting.voidspace()Convenience method to append a space to this sink.toString()
-
Constructor Details
-
DFormattingContext
public DFormattingContext()Create a default formatting context. IR types are rendered. -
DFormattingContext
Create a default formatting context. IR types are rendered.- Parameters:
ctx- optional method context; needed to fetch pool objects (e.g. strings) or fetch effective data
-
-
Method Details
-
setMethodContext
Set the method context used during formatting.- Parameters:
ctx- optional method context; needed to fetch pool objects (e.g. strings) or fetch effective data
-
getMethodContext
Retrieve the method context used during formatting.- Returns:
- the method context, or null if none is set
-
setUsePreferredNames
public void setUsePreferredNames(boolean usePreferredNames) Set whether preferred names should be used when formatting.- Parameters:
usePreferredNames- true to use preferred names
-
isUsePreferredNames
public boolean isUsePreferredNames()Determine whether preferred names should be used when formatting.- Returns:
- true if preferred names are enabled
-
setDisplayTypes
public void setDisplayTypes(boolean displayTypes) Set whether types should be displayed.- Parameters:
displayTypes- true to display types
-
isDisplayTypes
public boolean isDisplayTypes()Determine whether types should be displayed.- Returns:
- true if types are displayed
-
setDisplayCanThrow
public void setDisplayCanThrow(boolean displayCanThrow) Set whether may-throw markers should be displayed.- Parameters:
displayCanThrow- true to display may-throw markers
-
isDisplayCanThrow
public boolean isDisplayCanThrow()Determine whether may-throw markers should be displayed.- Returns:
- true if may-throw markers are displayed
-
append
Append the string representation of an object to this sink.- Parameters:
o- optional (if null, the 'null' string is appended)- Returns:
- this sink
-
append
Append a string to this sink.- Parameters:
str- string to append- Returns:
- this sink
-
append
Append an integer in base 10 to this sink.- Parameters:
i- integer to append- Returns:
- this sink
-
append
Append a character to this sink.- Parameters:
c- character to append- Returns:
- this sink
-
appendFormat
Append a formatted string to this sink.- Parameters:
format- format stringargs- arguments for the format string- Returns:
- this sink
-
space
public void space()Convenience method to append a space to this sink. -
paren
public void paren()Convenience method to append an opening parenthesis to this sink. -
parenClose
public void parenClose()Convenience method to append a closing parenthesis to this sink. -
brace
public void brace()Convenience method to append an opening brace to this sink. -
braceClose
public void braceClose()Convenience method to append a closing brace to this sink. -
bracket
public void bracket()Convenience method to append an opening bracket to this sink. -
bracketClose
public void bracketClose()Convenience method to append a closing bracket to this sink. -
angle
public void angle()Convenience method to append an opening angle bracket (less-than sign) to this sink. -
angleClose
public void angleClose()Convenience method to append a closing angle bracket (greater-than sign) to this sink. -
appendFormattedTypeIf
Append a type to this sink if types are to be rendered (seeisDisplayTypes()). Else, do nothing.- Parameters:
type- type to append
-
appendFormattedType
Append a type to this sink.- Parameters:
type- type to append
-
toString
-