org.eclipse.jet
Interface JET2Writer
-
All Known Subinterfaces:
-
BufferedJET2Writer
-
All Known Implementing Classes:
-
BodyContentWriter
-
public interface JET2Writer
Protocol for content writing in JET2 templates.
This interface is not intended to be implemented by clients.
Method Summary
|
void
|
addEventListener
(java.lang.String category,
IWriterListener listener)
Add a listener to the writer life cycle events. |
void
|
addPosition
(java.lang.String category,
org.eclipse.jface.text.Position position)
Deprecated. Use
BufferedJET2Writer.getAdapter(Class) to return an IDocument, and then
use IDocument.addPosition(String, Position) .
|
void
|
addPositionCategory
(java.lang.String category)
Deprecated. Use
BufferedJET2Writer.getAdapter(Class) to return an IDocument, and then
use IDocument.addPositionCategory(String) .
|
org.eclipse.jface.text.IDocument
|
getDocument
()
Deprecated. Use
BufferedJET2Writer .
|
IWriterListener[]
|
getEventListeners
()
Return the registered writer event listeners |
int
|
getLength
()
Deprecated. Use
BufferedJET2Writer.getContentLength()
|
JET2Writer
|
getParentWriter
()
Return the parent of this writer, if it was created via
newNestedContentWriter() . |
org.eclipse.jface.text.Position[]
|
getPositions
(java.lang.String category)
Deprecated. Use
BufferedJET2Writer.getAdapter(Class) to return an IDocument, and then
use IDocument.getPositions(String) .
|
JET2Writer
|
newNestedContentWriter
()
Create a writer for handling nested content. |
void
|
replace
(int offset,
int length,
java.lang.String text)
Deprecated. Use
BufferedJET2Writer.replaceContent(int, int, String) .
|
void
|
write
(boolean b)
Write the passed boolean by calling String.valueOf(boolean) . |
void
|
write
(char c)
Write the passed character by calling String.valueOf(char) . |
void
|
write
(char[] data)
Write the passed character array by calling String.valueOf(char[]) . |
void
|
write
(double d)
Write the passed double value by calling String.valueOf(double) . |
void
|
write
(float f)
Write the passed float value by calling String.valueOf(float) . |
void
|
write
(int i)
Write the passed integer by calling String.valueOf(int) . |
void
|
write
(
JET2Writer bodyContent)
Write the contents of the passed writer to this writer. |
void
|
write
(long l)
Write the passed long value calling String.valueOf(long) . |
void
|
write
(java.lang.Object obj)
Write the pass object by calling Object.toString() . |
void
|
write
(java.lang.String string)
Write the passed string. |
write
void write(java.lang.String string)
- Write the passed string.
-
-
Parameters:
-
string
- a string value.
write
void write(
JET2Writer bodyContent)
- Write the contents of the passed writer to this writer.
-
-
Parameters:
-
bodyContent
- a writer
write
void write(boolean b)
- Write the passed boolean by calling
String.valueOf(boolean)
.
-
-
Parameters:
-
b
- a boolean value
write
void write(char c)
- Write the passed character by calling
String.valueOf(char)
.
-
-
Parameters:
-
c
- a char value
write
void write(char[] data)
- Write the passed character array by calling
String.valueOf(char[])
.
-
-
Parameters:
-
data
- an array of characters
write
void write(double d)
- Write the passed double value by calling
String.valueOf(double)
.
-
-
Parameters:
-
d
- a double value
write
void write(float f)
- Write the passed float value by calling
String.valueOf(float)
.
-
-
Parameters:
-
f
- a float value
write
void write(int i)
- Write the passed integer by calling
String.valueOf(int)
.
-
-
Parameters:
-
i
- an integer value
write
void write(long l)
- Write the passed long value calling
String.valueOf(long)
.
-
-
Parameters:
-
l
- a long value.
write
void write(java.lang.Object obj)
- Write the pass object by calling
Object.toString()
.
-
-
Parameters:
-
obj
- an object.
newNestedContentWriter
JET2Writer newNestedContentWriter()
- Create a writer for handling nested content. The new writer will have access
to all position handlers defined on the parent writer (and its parents)
-
-
Returns:
- the nested content writer of type
BufferedJET2Writer
getParentWriter
JET2Writer getParentWriter()
- Return the parent of this writer, if it was created via
newNestedContentWriter()
.
-
-
Returns:
- the parent writer, or
null
.
getLength
int getLength()
-
Deprecated. Use
BufferedJET2Writer.getContentLength()
- Return the current length (in characters) of the output
-
-
Returns:
- the current length
getDocument
org.eclipse.jface.text.IDocument getDocument()
-
Deprecated. Use
BufferedJET2Writer
.
- Return the backing IDocument for this writer. Use this method to do advanced
writer processing, such as adding Positions for later re-writing of the document
contents.
-
-
Returns:
- the backing document
addEventListener
void addEventListener(java.lang.String category,
IWriterListener listener)
- Add a listener to the writer life cycle events. The writer records one listener per
category. Subsequent calls to this method with the same category value have no effect.
If the listener was created view
newNestedContentWriter()
, then the listener is added
to the root writer, rather than the listener itself.
-
-
Parameters:
-
category
- the listener category -
listener
- a listener
-
Throws:
-
java.lang.NullPointerException
- if listener is null
.
getEventListeners
IWriterListener[] getEventListeners()
- Return the registered writer event listeners
-
-
Returns:
- a possibly empty array of listeners
addPositionCategory
void addPositionCategory(java.lang.String category)
-
Deprecated. Use
BufferedJET2Writer.getAdapter(Class)
to return an IDocument, and then
use IDocument.addPositionCategory(String)
.
- Convenience method wrapping getDocument().addPositionCategory(String).
-
-
Parameters:
-
category
- a Position Category
-
Throws:
-
java.lang.IllegalArgumentException
- wrapping a BadPositionCategoryException
-
See Also:
-
IDocument.addPositionCategory(java.lang.String)
addPosition
void addPosition(java.lang.String category,
org.eclipse.jface.text.Position position)
-
Deprecated. Use
BufferedJET2Writer.getAdapter(Class)
to return an IDocument, and then
use IDocument.addPosition(String, Position)
.
- Convenience method wrapping getDocument().addPosition(String, Position).
Any
BadPositionCategoryException
or
BadLocationException
is wrapped in a
a runtime exception.
-
-
Parameters:
-
category
- a position category -
position
- a position
-
Throws:
-
WriterPositionException
- wrapping a BadPositionCategoryException
or BadLocationException
-
See Also:
-
IDocument.addPosition(java.lang.String, org.eclipse.jface.text.Position)
getPositions
org.eclipse.jface.text.Position[] getPositions(java.lang.String category)
-
Deprecated. Use
BufferedJET2Writer.getAdapter(Class)
to return an IDocument, and then
use IDocument.getPositions(String)
.
- Convenience method wrapping getDocument().getPositions(String).
Any
BadPositionCategoryException
is wrapped in a runtime exception.
-
-
Parameters:
-
category
- a position category
-
Returns:
- an array of positions
-
Throws:
-
WriterPositionException
- wrapping a BadPositionCategoryException
-
See Also:
-
IDocument.getPositions(java.lang.String)
replace
void replace(int offset,
int length,
java.lang.String text)
-
Deprecated. Use
BufferedJET2Writer.replaceContent(int, int, String)
.
- Convenience method wrapping getDocument().replace(int,int,String).
Any
BadLocationException
is wrapped in a runtime exception.
-
-
Parameters:
-
offset
- the offset of the text to replace -
length
- the length of the text to replace -
text
- the replacement text
-
Throws:
-
WriterPositionException
- wrapping a BadLocationException
-
See Also:
-
IDocument.replace(int, int, java.lang.String)