|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.topbraid.spin.model.print.StringPrintContext
public class StringPrintContext
A simple implementation of PrintContext that operates on a StringBuilder. By default this is using prefixes but not extra prefixes.
| Field Summary | |
|---|---|
protected java.lang.String |
indentationString
|
| Constructor Summary | |
|---|---|
StringPrintContext()
|
|
StringPrintContext(java.lang.StringBuilder sb)
|
|
| Method Summary | |
|---|---|
PrintContext |
clone()
Creates a clone of this PrintContext so that it can be used recursively. |
int |
getIndentation()
Gets the indentation level starting at 0. |
NodeToLabelMap |
getNodeToLabelMap()
Gets the Jena NodeToLabelMap associated with this. |
boolean |
getPrintPrefixes()
Checks whether prefix declarations shall be printed into the head of the query. |
java.lang.String |
getString()
|
java.lang.StringBuilder |
getStringBuilder()
|
boolean |
getUseExtraPrefixes()
Checks if the extra prefixes (such as afn:) shall be used to resolve qnames, even if they are not imported by the current model. |
boolean |
getUsePrefixes()
Checks if resource URIs shall be abbreviated with qnames at all. |
boolean |
isNested()
Checks if we are inside braces such as a nested expression. |
void |
print(java.lang.String str)
Prints a given string to the output stream. |
void |
printIndentation(int depth)
Prints the indentation string depth times. |
void |
printKeyword(java.lang.String str)
Prints a keyword to the output stream. |
void |
println()
Prints a line break to the output stream. |
void |
printURIResource(Resource resource)
Prints a URI to the output stream. |
void |
printVariable(java.lang.String str)
Prints a variable to the output stream. |
static java.lang.String |
qnameFor(Resource resource)
Work-around for a bug in Jena: Jena would use the default namespace of an imported Graph in a MultiUnion. |
void |
setIndentation(int value)
Changes the indentation level. |
void |
setIndentationString(java.lang.String value)
|
void |
setNested(boolean value)
Sets the nested flag. |
void |
setPrintPrefixes(boolean value)
Sets the printPrefixes flag. |
void |
setUseExtraPrefixes(boolean value)
Specifies whether the context shall use extra prefixes. |
void |
setUsePrefixes(boolean value)
Specifies whether the context shall use any prefixes at all. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String indentationString
| Constructor Detail |
|---|
public StringPrintContext()
public StringPrintContext(java.lang.StringBuilder sb)
| Method Detail |
|---|
public PrintContext clone()
PrintContext
clone in interface PrintContextclone in class java.lang.Objectpublic int getIndentation()
PrintContext
getIndentation in interface PrintContextPrintContext.setIndentation(int)public NodeToLabelMap getNodeToLabelMap()
PrintContext
getNodeToLabelMap in interface PrintContextpublic boolean getPrintPrefixes()
PrintContext
getPrintPrefixes in interface PrintContextpublic java.lang.String getString()
public java.lang.StringBuilder getStringBuilder()
public boolean getUseExtraPrefixes()
PrintContext
getUseExtraPrefixes in interface PrintContextPrintContext.setUseExtraPrefixes(boolean)public boolean getUsePrefixes()
PrintContext
getUsePrefixes in interface PrintContextpublic boolean isNested()
PrintContext
isNested in interface PrintContextpublic void print(java.lang.String str)
PrintContext
print in interface PrintContextstr - the String to printpublic void printIndentation(int depth)
PrintContext
printIndentation in interface PrintContextdepth - the number of indentations to printpublic void printKeyword(java.lang.String str)
PrintContext
printKeyword in interface PrintContextstr - the keyword stringpublic void println()
PrintContext
println in interface PrintContextpublic void printVariable(java.lang.String str)
PrintContext
printVariable in interface PrintContextstr - the variable string excluding the ?public void printURIResource(Resource resource)
PrintContext
printURIResource in interface PrintContextresource - the URI of the resource to printpublic static java.lang.String qnameFor(Resource resource)
resource - the Resource to get the qname for
public void setIndentation(int value)
PrintContext
setIndentation in interface PrintContextvalue - the new indentation levelpublic void setIndentationString(java.lang.String value)
public void setNested(boolean value)
PrintContext
setNested in interface PrintContextvalue - the new valuePrintContext.isNested()public void setPrintPrefixes(boolean value)
PrintContext
setPrintPrefixes in interface PrintContextvalue - the new valuePrintContext.getPrintPrefixes()public void setUseExtraPrefixes(boolean value)
PrintContext
setUseExtraPrefixes in interface PrintContextvalue - the new valuePrintContext.getUseExtraPrefixes()public void setUsePrefixes(boolean value)
PrintContext
setUsePrefixes in interface PrintContextvalue - the new valuePrintContext.getUsePrefixes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||