org.eclipse.xtext.resource
Class SaveOptions
java.lang.Object
org.eclipse.xtext.resource.SaveOptions
public class SaveOptions
- extends java.lang.Object
Immutable SaveOptions can be used to read and write options into the
map that is passed into Resource.save(Map)
.
Clients should create options by means of SaveOptions.newBuilder()
and
subsequent calls to configure the result or SaveOptions.defaultOptions()
.
The options map may be populated via toOptionsMap()
or addTo(Map)
.
Clients are free to extend this interface and the respective builder implementation.
- Author:
- Sebastian Zarnekow - Initial contribution and API
Field Summary |
protected static java.lang.String |
KEY
|
Constructor Summary |
protected |
SaveOptions(boolean formatting,
boolean validating)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
KEY
protected static final java.lang.String KEY
SaveOptions
protected SaveOptions(boolean formatting,
boolean validating)
getOptions
public static SaveOptions getOptions(java.util.Map<?,?> saveOptions)
- Transparently handles the deprecated options that could be passed as
map-entries to
Resource.save(Map)
and converts them to semantically equal SaveOptions
.
- Parameters:
the
- options-map or null
if none.
- Returns:
- the options to use. Will never return
null
.
addTo
public void addTo(java.util.Map<java.lang.Object,java.lang.Object> saveOptions)
- Configures the save options into the given map. The method modifies the
given parameter so it may not be an ImmutableMap or a read-only Map.
- Parameters:
saveOptions
- the options to be modified. May not be null
.
toOptionsMap
public java.util.Map<java.lang.Object,java.lang.Object> toOptionsMap()
isFormatting
public boolean isFormatting()
isValidating
public boolean isValidating()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
newBuilder
public static SaveOptions.Builder newBuilder()
defaultOptions
public static SaveOptions defaultOptions()
- This is equal to
builder().getOptions()
.