BUILDER
- the specific subclass type returned by the various builder API methodsATTRIBUTE
- the type of AttributeDefinition
produced by the build()
methodpublic abstract class AbstractAttributeDefinitionBuilder<BUILDER extends AbstractAttributeDefinitionBuilder,ATTRIBUTE extends AttributeDefinition> extends Object
AttributeDefinition
.Modifier and Type | Field and Description |
---|---|
protected AccessConstraintDefinition[] |
accessConstraints |
protected org.jboss.dmr.ModelNode[] |
allowedValues |
protected boolean |
allowExpression |
protected boolean |
allowNull |
protected String[] |
alternatives |
protected Map<String,org.jboss.dmr.ModelNode> |
arbitraryDescriptors |
protected String |
attributeGroup |
protected AttributeMarshaller |
attributeMarshaller |
protected ParameterCorrector |
corrector |
protected org.jboss.dmr.ModelNode |
defaultValue |
protected DeprecationData |
deprecated |
protected AttributeAccess.Flag[] |
flags |
protected int |
maxSize |
protected MeasurementUnit |
measurementUnit |
protected int |
minSize |
protected String |
name |
protected Boolean |
nullSignificant |
protected AttributeParser |
parser |
protected CapabilityReferenceRecorder |
referenceRecorder |
protected String[] |
requires |
protected boolean |
resourceOnly |
protected org.jboss.dmr.ModelType |
type |
protected boolean |
validateNull |
protected ParameterValidator |
validator |
protected String |
xmlName |
Constructor and Description |
---|
AbstractAttributeDefinitionBuilder(AttributeDefinition basis)
Creates a builder populated with the values of an existing attribute definition.
|
AbstractAttributeDefinitionBuilder(String attributeName,
AttributeDefinition basis)
Creates a builder populated with the values of an existing attribute definition, with an optional
change of the attribute's name.
|
AbstractAttributeDefinitionBuilder(String attributeName,
org.jboss.dmr.ModelType type)
Creates a builder for an attribute with the give name and type.
|
AbstractAttributeDefinitionBuilder(String attributeName,
org.jboss.dmr.ModelType type,
boolean allowNull)
Creates a builder for an attribute with the give name and type and nullability setting.
|
Modifier and Type | Method and Description |
---|---|
BUILDER |
addAccessConstraint(AccessConstraintDefinition accessConstraint)
Adds an access constraint to the set used with the attribute
|
BUILDER |
addAlternatives(String... alternatives)
Adds
names of alternative attributes that should not
be defined if this attribute is defined. |
BUILDER |
addArbitraryDescriptor(String arbitraryDescriptor,
org.jboss.dmr.ModelNode value)
Adds
arbitrary descriptor . |
BUILDER |
addFlag(AttributeAccess.Flag flag)
Adds a
special purpose flag that is relevant to the attribute |
abstract ATTRIBUTE |
build()
Create the
AttributeDefinition |
AccessConstraintDefinition[] |
getAccessConstraints() |
org.jboss.dmr.ModelNode[] |
getAllowedValues() |
String[] |
getAlternatives() |
Map<String,org.jboss.dmr.ModelNode> |
getArbitraryDescriptors() |
String |
getAttributeGroup() |
AttributeMarshaller |
getAttributeMarshaller() |
ParameterCorrector |
getCorrector() |
org.jboss.dmr.ModelNode |
getDefaultValue() |
DeprecationData |
getDeprecated() |
AttributeAccess.Flag[] |
getFlags() |
int |
getMaxSize() |
MeasurementUnit |
getMeasurementUnit() |
int |
getMinSize() |
String |
getName() |
Boolean |
getNullSignficant()
Deprecated.
Use
getNullSignificant() . |
Boolean |
getNullSignificant() |
AttributeParser |
getParser() |
String[] |
getRequires() |
org.jboss.dmr.ModelType |
getType() |
org.jboss.dmr.ModelNode |
getUndefinedMetricValue() |
ParameterValidator |
getValidator() |
String |
getXmlName() |
boolean |
isAllowExpression() |
boolean |
isAllowNull() |
protected boolean |
isFlagPresent(AttributeAccess.Flag flag)
Checks if a
special purpose flag has been recorded as relevant to the attribute |
boolean |
isResourceOnly() |
boolean |
isValidateNull() |
BUILDER |
removeFlag(AttributeAccess.Flag flag)
Removes a
special purpose flag from the set of those relevant to the attribute |
BUILDER |
setAccessConstraints(AccessConstraintDefinition... accessConstraints)
Sets access constraints to use with the attribute
|
BUILDER |
setAllowedValues(int... allowedValues)
Sets allowed values for attribute
|
BUILDER |
setAllowedValues(org.jboss.dmr.ModelNode... allowedValues)
Sets allowed values for attribute
|
BUILDER |
setAllowedValues(String... allowedValues)
Sets allowed values for attribute
|
BUILDER |
setAllowExpression(boolean allowExpression)
Sets whether the attribute should
allow expressions
If not set the default value is false . |
BUILDER |
setAllowNull(boolean allowNull)
Sets whether the attribute should
allow undefined values . |
BUILDER |
setAlternatives(String... alternatives)
Sets
names of alternative attributes that should not
be defined if this attribute is defined. |
BUILDER |
setAttributeGroup(String attributeGroup)
Sets the name of the attribute group with which this attribute is associated.
|
BUILDER |
setAttributeMarshaller(AttributeMarshaller marshaller)
Sets a custom
AttributeMarshaller to use for marshalling the attribute to xml. |
BUILDER |
setAttributeParser(AttributeParser parser)
Sets a custom
AttributeParser to use for parsing attribute from xml. |
BUILDER |
setCapabilityReference(CapabilityReferenceRecorder referenceRecorder)
Records that this attribute's value represents a reference to an instance of a
dynamic capability and assigns the
object that should be used to handle adding and removing capability requirements. |
BUILDER |
setCapabilityReference(String referencedCapability,
RuntimeCapability<?> dependentCapability)
Records that this attribute's value represents a reference to an instance of a
dynamic capability . |
BUILDER |
setCapabilityReference(String referencedCapability,
String dependentCapability,
boolean dynamicDependent)
Records that this attribute's value represents a reference to an instance of a
dynamic capability . |
BUILDER |
setCorrector(ParameterCorrector corrector)
Sets a
ParameterCorrector to use to adjust any user provided values
before validation
occurs. |
BUILDER |
setDefaultValue(org.jboss.dmr.ModelNode defaultValue)
Sets a
default value to use for the attribute if no
user-provided value is available. |
BUILDER |
setDeprecated(ModelVersion since)
Marks the attribute as deprecated since the given API version.
|
BUILDER |
setDeprecated(ModelVersion since,
boolean notificationUseful)
Marks the attribute as deprecated since the given API version, with the ability to configure that
notifications to the user (e.g.
|
BUILDER |
setFlags(AttributeAccess.Flag... flags)
Sets the
special purpose flags that are relevant to the attribute |
BUILDER |
setMaxSize(int maxSize)
Sets a maximum size for a collection-type attribute.
|
BUILDER |
setMeasurementUnit(MeasurementUnit unit)
Sets a
measurement unit to describe the unit in
which a numeric attribute is expressed. |
BUILDER |
setMinSize(int minSize)
Sets a minimum size description for a collection-type attribute.
|
BUILDER |
setName(String name)
Sets the
name for the attribute, which is only needed
if the attribute was created from an existing SimpleAttributeDefinition using
SimpleAttributeDefinitionBuilder.create(org.jboss.as.controller.SimpleAttributeDefinition)
method. |
BUILDER |
setNullSignficant(boolean nullSignficant)
Deprecated.
|
BUILDER |
setNullSignificant(boolean nullSignificant)
Sets whether an access control check is required to implicitly set an attribute to
undefined
in a resource "add" operation. |
BUILDER |
setRequires(String... requires)
Sets
names of required attributes that must
be defined if this attribute is defined. |
BUILDER |
setResourceOnly()
Marks an attribute as only relevant to a resource, and not a valid parameter to an "add" operation that
creates that resource.
|
BUILDER |
setRestartAllServices()
Adds the
AttributeAccess.Flag#RESTART_ALL_SERVICES flag and removes any conflicting flag. |
BUILDER |
setRestartJVM()
Adds the
AttributeAccess.Flag#RESTART_JVM flag and removes any conflicting flag. |
BUILDER |
setStorageRuntime()
Adds the
AttributeAccess.Flag#STORAGE_RUNTIME flag and removes any conflicting flag. |
BUILDER |
setType(org.jboss.dmr.ModelType type)
Sets the
type for the attribute. |
BUILDER |
setUndefinedMetricValue(org.jboss.dmr.ModelNode undefinedMetricValue)
Sets a
default value to use for the
metric if no runtime value is available (e.g. |
BUILDER |
setValidateNull(boolean validateNull)
Sets whether the attribute definition should check for
undefined values if
null is not allowed in addition to any validation provided by any
configured validator . |
BUILDER |
setValidator(ParameterValidator validator)
Sets the validator that should be used to validate attribute values.
|
BUILDER |
setXmlName(String xmlName)
Sets the
xml name for the attribute, which is only needed
if the name used for the attribute is different from its ordinary
name in the model . |
protected String name
protected org.jboss.dmr.ModelType type
protected String xmlName
protected boolean allowNull
protected boolean allowExpression
protected org.jboss.dmr.ModelNode defaultValue
protected MeasurementUnit measurementUnit
protected String[] alternatives
protected String[] requires
protected org.jboss.dmr.ModelNode[] allowedValues
protected ParameterCorrector corrector
protected ParameterValidator validator
protected boolean validateNull
protected int minSize
protected int maxSize
protected AttributeAccess.Flag[] flags
protected AttributeMarshaller attributeMarshaller
protected boolean resourceOnly
protected DeprecationData deprecated
protected AccessConstraintDefinition[] accessConstraints
protected Boolean nullSignificant
protected AttributeParser parser
protected String attributeGroup
protected CapabilityReferenceRecorder referenceRecorder
public AbstractAttributeDefinitionBuilder(String attributeName, org.jboss.dmr.ModelType type)
AbstractAttributeDefinitionBuilder(attributeName, type, false
public AbstractAttributeDefinitionBuilder(String attributeName, org.jboss.dmr.ModelType type, boolean allowNull)
attributeName
- the name
of the attribute. Cannot be null
type
- the type
of the attribute. Cannot be null
allowNull
- true
if the allows undefined values
public AbstractAttributeDefinitionBuilder(AttributeDefinition basis)
basis
- the existing attribute definition. Cannot be null
public AbstractAttributeDefinitionBuilder(String attributeName, AttributeDefinition basis)
attributeName
- the name
of the attribute,
or null
if the name from basis
should be usedbasis
- the existing attribute definition. Cannot be null
public abstract ATTRIBUTE build()
AttributeDefinition
null
public BUILDER setName(String name)
name
for the attribute, which is only needed
if the attribute was created from an existing SimpleAttributeDefinition
using
SimpleAttributeDefinitionBuilder.create(org.jboss.as.controller.SimpleAttributeDefinition)
method.name
- the attribute's name. null
is not allowedpublic BUILDER setXmlName(String xmlName)
xml name
for the attribute, which is only needed
if the name used for the attribute is different from its ordinary
name in the model
. If not set the default value is the name
passed to the builder constructor.xmlName
- the xml name. null
is allowedpublic BUILDER setType(org.jboss.dmr.ModelType type)
type
for the attribute.type
- the type. null
is not allowedpublic BUILDER setAllowNull(boolean allowNull)
allow undefined values
.
If not set the default value is the value provided to the builder constructor, or false
if no value is provided.allowNull
- true
if undefined values should be allowedpublic BUILDER setAllowExpression(boolean allowExpression)
allow expressions
If not set the default value is false
.allowExpression
- true
if expression values should be allowedpublic BUILDER setDefaultValue(org.jboss.dmr.ModelNode defaultValue)
default value
to use for the attribute if no
user-provided value is available.defaultValue
- the default value, or null
if no default should be usedpublic BUILDER setMeasurementUnit(MeasurementUnit unit)
measurement unit
to describe the unit in
which a numeric attribute is expressed.unit
- the unit. null
is allowedpublic BUILDER setCorrector(ParameterCorrector corrector)
ParameterCorrector
to use to adjust any user provided values
before validation
occurs.corrector
- the corrector. May be null
public BUILDER setValidator(ParameterValidator validator)
allow null
and
allow expression
settings, so the given validator
need not be properly configured for those validations.validator
- the validator. null
is allowedpublic BUILDER setValidateNull(boolean validateNull)
undefined
values if
null is not allowed
in addition to any validation provided by any
configured validator
. The default if not set is true
. The use
case for setting this to false
would be to ignore undefined values in the basic validation performed
by the AttributeDefinition
and instead let operation handlers validate using more complex logic
(e.g. checking for alternatives
.validateNull
- true
if additional validation should be performed; false
otherwisepublic BUILDER setAlternatives(String... alternatives)
names of alternative attributes
that should not
be defined if this attribute is defined.alternatives
- the attribute namespublic BUILDER addAlternatives(String... alternatives)
names of alternative attributes
that should not
be defined if this attribute is defined.alternatives
- the attribute namespublic BUILDER addArbitraryDescriptor(String arbitraryDescriptor, org.jboss.dmr.ModelNode value)
arbitrary descriptor
.arbitraryDescriptor
- the arbitrary descriptor name.value
- the value of the arbitrary descriptor.public BUILDER setRequires(String... requires)
names of required attributes
that must
be defined if this attribute is defined.requires
- the attribute namespublic BUILDER setFlags(AttributeAccess.Flag... flags)
special purpose flags
that are relevant to the attributeflags
- the flagspublic BUILDER addFlag(AttributeAccess.Flag flag)
special purpose flag
that is relevant to the attributeflag
- the flagpublic BUILDER removeFlag(AttributeAccess.Flag flag)
special purpose flag
from the set of those relevant to the attributeflag
- the flagprotected boolean isFlagPresent(AttributeAccess.Flag flag)
special purpose flag
has been recorded as relevant to the attributeflag
- the flagpublic BUILDER setStorageRuntime()
AttributeAccess.Flag#STORAGE_RUNTIME
flag and removes any conflicting flag.public BUILDER setRestartAllServices()
AttributeAccess.Flag#RESTART_ALL_SERVICES
flag and removes any conflicting flag.public BUILDER setRestartJVM()
AttributeAccess.Flag#RESTART_JVM
flag and removes any conflicting flag.public BUILDER setMaxSize(int maxSize)
SimpleAttributeDefinition
even though
intuitively a user may expect it would be used.maxSize
- the maximum sizepublic BUILDER setMinSize(int minSize)
SimpleAttributeDefinition
even though
intuitively a user may expect it would be used.minSize
- the minimum sizepublic BUILDER setAttributeMarshaller(AttributeMarshaller marshaller)
AttributeMarshaller
to use for marshalling the attribute to xml.
If not set, a DefaultAttributeMarshaller
will be used.marshaller
- the marshaller. Can be null
public BUILDER setAttributeParser(AttributeParser parser)
AttributeParser
to use for parsing attribute from xml.
If not set, a AttributeParser.SIMPLE
will be used.parser
- the parser. Can be null
public BUILDER setResourceOnly()
public BUILDER setDeprecated(ModelVersion since)
setDeprecated(ModelVersion, boolean)
with the notificationUseful
parameter
set to true
.since
- the API version, with the API being the one (core or a subsystem) in which the attribute is usedpublic BUILDER setDeprecated(ModelVersion since, boolean notificationUseful)
notificationUseful
param is true
the text
description of the attribute deprecation available from the read-resource-description
management operation should provide useful information about how the user can avoid using
the attribute.since
- the API version, with the API being the one (core or a subsystem) in which the attribute is usednotificationUseful
- whether actively advising the user about the deprecation is usefulpublic BUILDER setAccessConstraints(AccessConstraintDefinition... accessConstraints)
accessConstraints
- the constraintspublic BUILDER addAccessConstraint(AccessConstraintDefinition accessConstraint)
accessConstraint
- the constraintpublic BUILDER setNullSignificant(boolean nullSignificant)
undefined
in a resource "add" operation. "Implicitly" setting an attribute refers to not providing a value for
it in the add operation, leaving the attribute in an undefined state. If not set
the default value is whether the attribute allows null
and
has a default value
.nullSignificant
- true
if an undefined value is significant@Deprecated public BUILDER setNullSignficant(boolean nullSignficant)
setNullSignificant(boolean)
.public BUILDER setAttributeGroup(String attributeGroup)
attributeGroup
- the attribute group name. Cannot be an empty string but can be null
if the attribute is not associated with a group.public BUILDER setAllowedValues(org.jboss.dmr.ModelNode... allowedValues)
allowedValues
- values that are legal as part in this attributepublic BUILDER setAllowedValues(String... allowedValues)
allowedValues
- values that are legal as part in this attributepublic BUILDER setAllowedValues(int... allowedValues)
allowedValues
- values that are legal as part in this attributepublic BUILDER setCapabilityReference(String referencedCapability, RuntimeCapability<?> dependentCapability)
dynamic capability
.
This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)
passing in a CapabilityReferenceRecorder.DefaultCapabilityReferenceRecorder
constructed using the parameters passed to this method.
referencedCapability
- the name of the dynamic capability the dynamic portion of whose name is
represented by the attribute's valuedependentCapability
- the capability that depends on referencedCapability
AttributeDefinition.addCapabilityRequirements(OperationContext, ModelNode)
,
AttributeDefinition.removeCapabilityRequirements(OperationContext, ModelNode)
public BUILDER setCapabilityReference(String referencedCapability, String dependentCapability, boolean dynamicDependent)
dynamic capability
.
This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)
passing in a CapabilityReferenceRecorder.DefaultCapabilityReferenceRecorder
constructed using the parameters passed to this method.
referencedCapability
- the name of the dynamic capability the dynamic portion of whose name is
represented by the attribute's valuedependentCapability
- the name of the capability that depends on referencedCapability
dynamicDependent
- true
if dependentCapability
is a dynamic capability, the dynamic
portion of which comes from the name of the resource with which
the attribute is associatedAttributeDefinition.addCapabilityRequirements(OperationContext, ModelNode)
,
AttributeDefinition.removeCapabilityRequirements(OperationContext, ModelNode)
public BUILDER setCapabilityReference(CapabilityReferenceRecorder referenceRecorder)
dynamic capability
and assigns the
object that should be used to handle adding and removing capability requirements.referenceRecorder
- recorder to handle adding and removing capability requirements. May be null
AttributeDefinition.addCapabilityRequirements(OperationContext, ModelNode)
,
AttributeDefinition.removeCapabilityRequirements(OperationContext, ModelNode)
public BUILDER setUndefinedMetricValue(org.jboss.dmr.ModelNode undefinedMetricValue)
default value
to use for the
metric if no runtime value is available (e.g. we are a server running in admin-only mode).undefinedMetricValue
- the default value, or null
if no default should be usedpublic String getName()
public org.jboss.dmr.ModelType getType()
public String getXmlName()
public boolean isAllowNull()
public boolean isAllowExpression()
public org.jboss.dmr.ModelNode getDefaultValue()
public MeasurementUnit getMeasurementUnit()
public String[] getAlternatives()
public String[] getRequires()
public ParameterCorrector getCorrector()
public ParameterValidator getValidator()
public boolean isValidateNull()
public int getMinSize()
public int getMaxSize()
public AttributeAccess.Flag[] getFlags()
public AttributeMarshaller getAttributeMarshaller()
public boolean isResourceOnly()
public DeprecationData getDeprecated()
public AccessConstraintDefinition[] getAccessConstraints()
public Boolean getNullSignificant()
public org.jboss.dmr.ModelNode getUndefinedMetricValue()
@Deprecated public Boolean getNullSignficant()
getNullSignificant()
.public AttributeParser getParser()
public String getAttributeGroup()
public org.jboss.dmr.ModelNode[] getAllowedValues()
Copyright © 2023 JBoss by Red Hat. All rights reserved.