public final class FormatPreferences extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FormatPreferences.Indentation
A category of indentation.
|
static class |
FormatPreferences.Opt
Option flags.
|
static class |
FormatPreferences.Space
The location or position of a space.
|
static class |
FormatPreferences.SpaceType
The type of space to apply.
|
static class |
FormatPreferences.Wrapping
Categories for wrapping rules.
|
static class |
FormatPreferences.WrappingMode
The wrapping mode.
|
Constructor and Description |
---|
FormatPreferences()
Construct a new instance using default values.
|
FormatPreferences(ClassLoader classLoader)
Construct a new instance using a properties file loaded from the given class loader.
|
FormatPreferences(File file)
Construct a new instance using a properties file loaded from the given file name.
|
FormatPreferences(Filer filer)
Construct a new instance using a properties file loaded from the given annotation processing filer.
|
FormatPreferences(Filer filer,
String name)
Construct a new instance using a properties file loaded from the given annotation processing filer.
|
FormatPreferences(InputStream inputStream)
Construct a new instance using a properties read from the given stream.
|
FormatPreferences(Properties properties)
Construct a new instance, mapping the given properties to the formatter configurations.
|
FormatPreferences(Reader reader)
Construct a new instance using a properties read from the given stream.
|
Modifier and Type | Method and Description |
---|---|
void |
addOption(FormatPreferences.Opt... opts)
Add option flags to these preferences.
|
void |
clearIndentAbsolute(FormatPreferences.Indentation indentation)
Clear absolute indentation for the given context.
|
int |
getIndent(FormatPreferences.Indentation indentation)
Get the configured indentation for the given context.
|
int |
getLineLength()
Get the configured line length.
|
FormatPreferences.SpaceType |
getSpaceType(FormatPreferences.Space space)
Get the spacing type for a given space context.
|
FormatPreferences.WrappingMode |
getWrapMode(FormatPreferences.Wrapping wrapping)
Get the wrapping mode for the given wrapping context.
|
boolean |
hasOption(FormatPreferences.Opt opt)
Determine whether the given option flag is set on these preferences.
|
boolean |
isIndentAbsolute(FormatPreferences.Indentation indentation)
Determine whether the indentation for the given context is absolute or relative.
|
void |
removeOption(FormatPreferences.Opt... opts)
Remove option flags from these preferences.
|
void |
setAllSpaceTypes(FormatPreferences.SpaceType toType,
FormatPreferences.Space... spaces)
Set several space contexts to the same spacing type.
|
int |
setIndent(FormatPreferences.Indentation indentation,
int value)
Set the configured indentation for the given context.
|
void |
setIndentAbsolute(FormatPreferences.Indentation indentation)
Set absolute indentation for the given context.
|
FormatPreferences.SpaceType |
setSpaceType(FormatPreferences.Space space,
FormatPreferences.SpaceType spaceType)
Set the spacing type for the given space context.
|
FormatPreferences.WrappingMode |
setWrapMode(FormatPreferences.Wrapping wrapping,
FormatPreferences.WrappingMode mode)
Set the wrapping mode for the given wrapping context.
|
public FormatPreferences()
public FormatPreferences(Properties properties)
properties
- the properties to mappublic FormatPreferences(ClassLoader classLoader) throws IOException
classLoader
- the class loaderIOException
- if an error occurs while reading the propertiespublic FormatPreferences(Filer filer, String name) throws IOException
filer
- the filer to read fromname
- the name of the properties file to readIOException
- if an error occurs while reading the propertiespublic FormatPreferences(Filer filer) throws IOException
filer
- the filer to read fromIOException
- if an error occurs while reading the propertiespublic FormatPreferences(File file) throws IOException
file
- the name of the properties file to readIOException
- if an error occurs while reading the propertiespublic FormatPreferences(InputStream inputStream) throws IOException
inputStream
- the stream to read properties fromIOException
- if an error occurs while reading the propertiespublic FormatPreferences(Reader reader) throws IOException
reader
- the stream to read properties fromIOException
- if an error occurs while reading the propertiespublic int getLineLength()
public int getIndent(FormatPreferences.Indentation indentation)
indentation
- the indentation contextpublic int setIndent(FormatPreferences.Indentation indentation, int value)
indentation
- the indentation contextvalue
- the indentationpublic boolean isIndentAbsolute(FormatPreferences.Indentation indentation)
indentation
- the indentation contexttrue
if absolute, false
if relativepublic void setIndentAbsolute(FormatPreferences.Indentation indentation)
indentation
- the indentation contextpublic void clearIndentAbsolute(FormatPreferences.Indentation indentation)
indentation
- the indentation contextpublic FormatPreferences.SpaceType setSpaceType(FormatPreferences.Space space, FormatPreferences.SpaceType spaceType)
space
- the space contextspaceType
- the space typepublic void setAllSpaceTypes(FormatPreferences.SpaceType toType, FormatPreferences.Space... spaces)
toType
- the type to set tospaces
- the space contextspublic FormatPreferences.SpaceType getSpaceType(FormatPreferences.Space space)
space
- the space contextpublic FormatPreferences.WrappingMode getWrapMode(FormatPreferences.Wrapping wrapping)
wrapping
- the wrapping contextpublic FormatPreferences.WrappingMode setWrapMode(FormatPreferences.Wrapping wrapping, FormatPreferences.WrappingMode mode)
wrapping
- the wrapping contextmode
- the wrapping modepublic void addOption(FormatPreferences.Opt... opts)
opts
- the flags to addpublic void removeOption(FormatPreferences.Opt... opts)
opts
- the flags to removepublic boolean hasOption(FormatPreferences.Opt opt)
opt
- the flag to checktrue
if the flag is present, false
if it is absentCopyright © 2019 JBoss by Red Hat. All rights reserved.