T
- the underlying parameterpublic abstract class OptionalParameter<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
OptionalParameter.Deserializer<T>
Deserializes the parameter
|
static class |
OptionalParameter.Serializer
Serializes the parameter
|
Constructor and Description |
---|
OptionalParameter(Class<T> contentClass) |
OptionalParameter(OptionalParameter<T> other)
Produces a shallow copy
You have to implement deep content copying yourself
|
Modifier and Type | Method and Description |
---|---|
T |
getContent() |
Class<T> |
getContentClass() |
T |
getContentOrDefault(T defaultValue)
Returns the content if enabled, otherwise the default value
|
boolean |
isEnabled() |
void |
setContent(T content) |
void |
setEnabled(boolean enabled) |
T |
setNewInstance()
Adds a new instance of the content class
Override this method for types that cannot be default-constructed
|
String |
toString() |
public OptionalParameter(Class<T> contentClass)
contentClass
- the stored contentpublic OptionalParameter(OptionalParameter<T> other)
other
- the originalpublic T setNewInstance()
public boolean isEnabled()
public void setEnabled(boolean enabled)
public T getContent()
public void setContent(T content)
public T getContentOrDefault(T defaultValue)
defaultValue
- the default valueCopyright © 2020–2022 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.