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 boolean |
allowExpression |
protected boolean |
allowNull |
protected String[] |
alternatives |
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 |
nullSignficant |
protected AttributeParser |
parser |
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 |
addFlag(AttributeAccess.Flag flag)
Adds a
special purpose flag that is relevant to the attribute |
abstract ATTRIBUTE |
build()
Create the
AttributeDefinition |
AccessConstraintDefinition[] |
getAccessConstraints() |
String[] |
getAlternatives() |
AttributeMarshaller |
getAttributeMarshaller() |
ParameterCorrector |
getCorrector() |
org.jboss.dmr.ModelNode |
getDefaultValue() |
DeprecationData |
getDeprecated() |
AttributeAccess.Flag[] |
getFlags() |
int |
getMaxSize() |
MeasurementUnit |
getMeasurementUnit() |
int |
getMinSize() |
String |
getName() |
Boolean |
getNullSignficant() |
AttributeParser |
getParser() |
String[] |
getRequires() |
org.jboss.dmr.ModelType |
getType() |
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 |
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 |
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 |
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 |
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 |
setNullSignficant(boolean nullSignficant)
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 |
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 final 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 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 nullSignficant
protected AttributeParser parser
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 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 allowpublic 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 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)
since
- the API version, with the API being the one (core or a subsystem) in which the attribute is usedpublic BUILDER setAccessConstraints(AccessConstraintDefinition... accessConstraints)
accessConstraints
- the constraintspublic BUILDER addAccessConstraint(AccessConstraintDefinition accessConstraint)
accessConstraint
- the constraintpublic BUILDER setNullSignficant(boolean nullSignficant)
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
.nullSignficant
- true
if an undefined value is significantpublic 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 getNullSignficant()
public AttributeParser getParser()
Copyright © 2015 JBoss by Red Hat. All rights reserved.