public class MacroDefinition extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_SCHEMA_VERSION |
static String |
STORAGE_VERSION_1 |
static String |
STORAGE_VERSION_2 |
Constructor and Description |
---|
MacroDefinition()
Deprecated.
since 5.8. Use
MacroDefinitionBuilder |
MacroDefinition(MacroDefinition macroDefinition)
Copy constructor.
|
MacroDefinition(String name,
MacroBody body,
Map<String,String> parameters,
Map<String,Object> typedParameters,
String storageVersion)
Deprecated.
since 5.7. Use
MacroDefinitionBuilder |
MacroDefinition(String name,
MacroBody body,
Map<String,String> parameters,
Map<String,Object> typedParameters,
String storageVersion,
com.atlassian.fugue.Option<MacroId> macroId,
int schemaVersion)
Deprecated.
since 5.8. Use
MacroDefinitionBuilder |
MacroDefinition(String name,
MacroBody body,
String defaultParameterValue,
Map<String,String> parameters)
Deprecated.
since 5.2. Use
MacroDefinitionBuilder |
Modifier and Type | Method and Description |
---|---|
static MacroDefinitionBuilder |
builder()
The correct way to construct a new MacroDefinition.
|
static MacroDefinitionBuilder |
builder(String macroName)
The correct way to construct a new MacroDefinition.
|
boolean |
equals(Object o) |
MacroBody |
getBody() |
Streamable |
getBodyStream() |
String |
getBodyText() |
Macro.BodyType |
getBodyType() |
String |
getDefaultParameterValue()
Equivalent to
getParameter(java.lang.String) or getTypedParameter(java.lang.String, java.lang.Class<T>) with "" |
com.atlassian.fugue.Option<MacroId> |
getMacroId()
Each macro definition is assigned a macroId when the page is stored, this can be used to identify macros within a
page.
|
String |
getName() |
String |
getParameter(String name) |
Map<String,String> |
getParameters() |
int |
getSchemaVersion()
The macro schema is the definition of the parameters and the macro body, an incompatible change of schema will
require an increase in the schema version and a corresponding macro-schema-migration module to migrate from the
old schema to the new schema.
|
Streamable |
getStorageBodyStream() |
String |
getStorageVersion() |
Streamable |
getTransformedBodyStream() |
<T> T |
getTypedParameter(String name,
Class<T> type) |
Map<String,Object> |
getTypedParameters() |
boolean |
hasBody() |
int |
hashCode() |
boolean |
isValid() |
String |
macroHash()
The macroHash is used to identify a macro if there is no macroId stored.
|
void |
setBody(MacroBody body) |
void |
setDefaultParameterValue(String defaultParameterValue) |
void |
setMacroId(com.atlassian.fugue.Option<MacroId> macroId) |
void |
setName(String name) |
void |
setParameter(String name,
String value) |
void |
setParameters(Map<String,String> parameters) |
void |
setSchemaVersion(int schemaVersion) |
void |
setStorageVersion(String storageVersion) |
void |
setTypedParameter(String name,
Object value) |
void |
setTypedParameters(Map<String,Object> typedParameters) |
String |
toString() |
public static final String STORAGE_VERSION_1
public static final String STORAGE_VERSION_2
public static final int INITIAL_SCHEMA_VERSION
@Deprecated public MacroDefinition()
MacroDefinitionBuilder
public MacroDefinition(MacroDefinition macroDefinition)
macroDefinition
- copy the state of this macro definition into this new instance@Deprecated public MacroDefinition(String name, MacroBody body, String defaultParameterValue, Map<String,String> parameters)
MacroDefinitionBuilder
name
- the name of the macrobody
- the macro body. Should be set to null if the macro does not have a body. Also see
PlainTextMacroBody and RichTextMacroBody.defaultParameterValue
- the default macro parameter value. This value is not assigned an actual parameter
name.parameters
- the macro parameters@Deprecated public MacroDefinition(String name, MacroBody body, Map<String,String> parameters, Map<String,Object> typedParameters, String storageVersion)
MacroDefinitionBuilder
name
- the name of the macrobody
- the macro body. Should be set to null if the macro does not have a body. Also see
PlainTextMacroBody and RichTextMacroBody.parameters
- the macro parameterstypedParameters
- the macro parameters that are pre-parsed into their associated types@Deprecated public MacroDefinition(String name, MacroBody body, Map<String,String> parameters, Map<String,Object> typedParameters, String storageVersion, com.atlassian.fugue.Option<MacroId> macroId, int schemaVersion)
MacroDefinitionBuilder
name
- the name of the macrobody
- the macro body. Should be set to null if the macro does not have a body. Also see
PlainTextMacroBody and RichTextMacroBody.parameters
- the macro parameterstypedParameters
- the macro parameters that are pre-parsed into their associated typesmacroId
- the unique id of this macropublic static MacroDefinitionBuilder builder()
public static MacroDefinitionBuilder builder(String macroName)
public String getName()
public String getDefaultParameterValue()
getParameter(java.lang.String)
or getTypedParameter(java.lang.String, java.lang.Class<T>)
with ""public String getBodyText()
getStorageBodyStream()
,
getTransformedBodyStream()
,
RequiresFormat
public Streamable getBodyStream()
getStorageBodyStream()
,
getTransformedBodyStream()
,
RequiresFormat
public Streamable getStorageBodyStream()
public Streamable getTransformedBodyStream()
public MacroBody getBody()
public Macro.BodyType getBodyType()
public boolean hasBody()
public void setName(String name)
public void setDefaultParameterValue(String defaultParameterValue)
public void setBody(MacroBody body)
public String getStorageVersion()
public void setStorageVersion(String storageVersion)
public com.atlassian.fugue.Option<MacroId> getMacroId()
If there is no macroId specified for this macro, it means the page containing this macro has not yet been saved after the macro id changes were committed to Confluence.
public void setMacroId(com.atlassian.fugue.Option<MacroId> macroId)
public int getSchemaVersion()
public void setSchemaVersion(int schemaVersion)
public boolean isValid()
public String macroHash()
Copyright © 2003–2017 Atlassian. All rights reserved.