Package org.springframework.amqp.core
Class AbstractDeclarable
- java.lang.Object
-
- org.springframework.amqp.core.AbstractDeclarable
-
- All Implemented Interfaces:
Declarable
- Direct Known Subclasses:
AbstractExchange
,Binding
,Queue
public abstract class AbstractDeclarable extends Object implements Declarable
Base class forDeclarable
classes.- Since:
- 1.2
- Author:
- Gary Russell
-
-
Constructor Summary
Constructors Constructor Description AbstractDeclarable()
AbstractDeclarable(Map<String,Object> arguments)
Construct an instance with the supplied arguments, or an empty map if null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArgument(String argName, Object argValue)
Add an argument to the declarable.Map<String,Object>
getArguments()
Collection<?>
getDeclaringAdmins()
The collection ofAmqpAdmin
s that should declare this object; if empty, all admins should declare.boolean
isIgnoreDeclarationExceptions()
Should ignore exceptions (such as mismatched args) when declaring.Object
removeArgument(String name)
Remove an argument from the declarable.void
setAdminsThatShouldDeclare(Object... adminArgs)
TheAmqpAdmin
s that should declare this object; default is all admins.void
setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)
Set to true to ignore exceptions such as mismatched properties when declaring.void
setShouldDeclare(boolean shouldDeclare)
Whether or not this object should be automatically declared by anyAmqpAdmin
.boolean
shouldDeclare()
Whether or not this object should be automatically declared by anyAmqpAdmin
.
-
-
-
Method Detail
-
shouldDeclare
public boolean shouldDeclare()
Description copied from interface:Declarable
Whether or not this object should be automatically declared by anyAmqpAdmin
.- Specified by:
shouldDeclare
in interfaceDeclarable
- Returns:
- true if the object should be declared.
-
setShouldDeclare
public void setShouldDeclare(boolean shouldDeclare)
Whether or not this object should be automatically declared by anyAmqpAdmin
. Default istrue
.- Parameters:
shouldDeclare
- true or false.
-
getDeclaringAdmins
public Collection<?> getDeclaringAdmins()
Description copied from interface:Declarable
The collection ofAmqpAdmin
s that should declare this object; if empty, all admins should declare.- Specified by:
getDeclaringAdmins
in interfaceDeclarable
- Returns:
- the collection.
-
isIgnoreDeclarationExceptions
public boolean isIgnoreDeclarationExceptions()
Description copied from interface:Declarable
Should ignore exceptions (such as mismatched args) when declaring.- Specified by:
isIgnoreDeclarationExceptions
in interfaceDeclarable
- Returns:
- true if should ignore.
-
setIgnoreDeclarationExceptions
public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)
Set to true to ignore exceptions such as mismatched properties when declaring.- Parameters:
ignoreDeclarationExceptions
- the ignoreDeclarationExceptions.- Since:
- 1.6
-
setAdminsThatShouldDeclare
public void setAdminsThatShouldDeclare(Object... adminArgs)
Description copied from interface:Declarable
TheAmqpAdmin
s that should declare this object; default is all admins.
A null argument, or an array/varArg with a single null argument, clears the collection (setAdminsThatShouldDeclare((AmqpAdmin) null)
orsetAdminsThatShouldDeclare((AmqpAdmin[]) null)
). Clearing the collection resets the behavior such that all admins will declare the object.- Specified by:
setAdminsThatShouldDeclare
in interfaceDeclarable
- Parameters:
adminArgs
- The admins.
-
addArgument
public void addArgument(String argName, Object argValue)
Description copied from interface:Declarable
Add an argument to the declarable.- Specified by:
addArgument
in interfaceDeclarable
- Parameters:
argName
- the argument name.argValue
- the argument value.
-
removeArgument
public Object removeArgument(String name)
Description copied from interface:Declarable
Remove an argument from the declarable.- Specified by:
removeArgument
in interfaceDeclarable
- Parameters:
name
- the argument name.- Returns:
- the argument value or null if not present.
-
-