Package org.agrona.generation
Class StringWriterOutputManager
- java.lang.Object
-
- org.agrona.generation.StringWriterOutputManager
-
- All Implemented Interfaces:
DynamicPackageOutputManager
,OutputManager
public class StringWriterOutputManager extends java.lang.Object implements DynamicPackageOutputManager
AnOutputManager
which can store source files asStringWriter
buy source file name.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
initialPackageName
private java.lang.String
packageName
private java.util.HashMap<java.lang.String,java.io.StringWriter>
sourceFileByName
-
Constructor Summary
Constructors Constructor Description StringWriterOutputManager()
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all source files in thisOutputManager
and reset the initial package name.java.io.Writer
createOutput(java.lang.String name)
Create a new output destination based on a name.java.lang.CharSequence
getSource(java.lang.String name)
Get aCharSequence
which represents the source file.java.util.Map<java.lang.String,java.lang.CharSequence>
getSources()
Get aMap
of all source files.void
setPackageName(java.lang.String packageName)
Set the package name to be used for source files.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.agrona.generation.OutputManager
withOutput
-
-
-
-
Method Detail
-
createOutput
public java.io.Writer createOutput(java.lang.String name)
Create a new output destination based on a name. The user is responsible for callingWriter.close()
.- Specified by:
createOutput
in interfaceOutputManager
- Parameters:
name
- of the given output.- Returns:
- A
Writer
to which the code generation should be output.
-
setPackageName
public void setPackageName(java.lang.String packageName)
Set the package name to be used for source files.- Specified by:
setPackageName
in interfaceDynamicPackageOutputManager
- Parameters:
packageName
- to be used for source files.
-
getSource
public java.lang.CharSequence getSource(java.lang.String name)
Get aCharSequence
which represents the source file.- Parameters:
name
- of the source file.- Returns:
CharSequence
which represents the source file.
-
getSources
public java.util.Map<java.lang.String,java.lang.CharSequence> getSources()
Get aMap
of all source files.- Returns:
- a
Map
of all source files.
-
clear
public void clear()
Clear all source files in thisOutputManager
and reset the initial package name.
-
-