Class AbstractAttributeDefinitionBuilder<BUILDER extends AbstractAttributeDefinitionBuilder<BUILDER,ATTRIBUTE>,ATTRIBUTE extends AttributeDefinition>
- Type Parameters:
BUILDER- the specific subclass type returned by the various builder API methodsATTRIBUTE- the type ofAttributeDefinitionproduced by thebuild()method
- Direct Known Subclasses:
ListAttributeDefinition.Builder,MapAttributeDefinition.Builder,ObjectTypeAttributeDefinition.Builder,SimpleAttributeDefinitionBuilder
AttributeDefinition.- Author:
- Tomaz Cerar
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractAttributeDefinitionBuilder(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 optional) Creates a builder for an attribute with the give name and type and nullability setting.Creates a builder populated with the values of an existing attribute definition. -
Method Summary
Modifier and TypeMethodDescriptionaddAccessConstraint(AccessConstraintDefinition accessConstraint) Adds an access constraint to the set used with the attributeaddAlternatives(String... alternatives) Addsnames of alternative attributesthat should not be defined if this attribute is defined.addArbitraryDescriptor(String arbitraryDescriptor, org.jboss.dmr.ModelNode value) Addsarbitrary descriptor.addFlag(AttributeAccess.Flag flag) Adds aspecial purpose flagthat is relevant to the attributeabstract ATTRIBUTEbuild()Create theAttributeDefinitionorg.jboss.dmr.ModelNode[]String[]protected final CapabilityReferenceRecorderorg.jboss.dmr.ModelNodegetFlags()intintgetName()String[]org.jboss.dmr.ModelTypegetType()org.jboss.dmr.ModelNodebooleanprotected booleanChecks if aspecial purpose flaghas been recorded as relevant to the attributebooleanbooleanfinal BUILDERremoveAlternatives(String... alternatives) Removesnames of alternative attributesfrom the set of those that should not be defined if this attribute is defined.Removes aspecial purpose flagfrom the set of those relevant to the attributesetAccessConstraints(AccessConstraintDefinition... accessConstraints) Sets access constraints to use with the attributesetAllowedValues(int... allowedValues) Sets allowed values for attributesetAllowedValues(String... allowedValues) Sets allowed values for attributesetAllowedValues(org.jboss.dmr.ModelNode... allowedValues) Sets allowed values for attributesetAllowExpression(boolean allowExpression) Sets whether the attribute shouldallow expressionsIf not set the default value isfalse.setAlternatives(String... alternatives) Setsnames of alternative attributesthat should not be defined if this attribute is defined.setAttributeGroup(String attributeGroup) Sets the name of the attribute group with which this attribute is associated.setAttributeMarshaller(AttributeMarshaller marshaller) Sets a customAttributeMarshallerto use for marshalling the attribute to xml.setAttributeParser(AttributeParser parser) Sets a customAttributeParserto use for parsing attribute from xml.setCapabilityReference(String referencedCapability) Records that this attribute's value represents a reference to an instance of adynamic capability.setCapabilityReference(String referencedCapability, String dependentCapability) Records that this attribute's value represents a reference to an instance of adynamic capability.setCapabilityReference(String referencedCapability, AttributeDefinition... dependantAttributes) Records that this attribute's value represents a reference to an instance of adynamic capability.setCapabilityReference(String referencedCapability, RuntimeCapability<?> dependentCapability) Records that this attribute's value represents a reference to an instance of adynamic capability.setCapabilityReference(RuntimeCapability capability, String referencedCapability, AttributeDefinition... dependantAttributes) Records that this attribute's value represents a reference to an instance of adynamic capability.setCapabilityReference(CapabilityReferenceRecorder referenceRecorder) Records that this attribute's value represents a reference to an instance of adynamic capabilityand assigns the object that should be used to handle adding and removing capability requirements.setCorrector(ParameterCorrector corrector) Sets aParameterCorrectorto use to adjust any user provided values beforevalidationoccurs.setDefaultValue(org.jboss.dmr.ModelNode defaultValue) Sets adefault valueto use for the attribute if no user-provided value is available.setDeprecated(ModelVersion since) Marks the attribute as deprecated since the given API version.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. via a log message) about deprecation of the attribute should not be emitted.final BUILDERMarks that support for use of an expression for the attribute's value is deprecated and may be removed in a future release.setFlags(AttributeAccess.Flag... flags) Sets thespecial purpose flagsthat are relevant to the attributesetMaxSize(int maxSize) Sets a maximum size for a collection-type attribute or one whose value is a string or byte[].Sets ameasurement unitto describe the unit in which a numeric attribute is expressed.setMinSize(int minSize) Sets a minimum size description for a collection-type attribute or one whose value is a string or byte[].setNullSignificant(boolean nullSignificant) Sets whether an access control check is required to implicitly set an attribute toundefinedin a resource "add" operation.setRequired(boolean required) Sets whether the attribute shouldrequire a defined valuein the absence ofalternatives.setRequires(String... requires) Setsnames of required attributesthat must be defined if this attribute is defined.Marks an attribute as only relevant to a resource, and not a valid parameter to an "add" operation that creates that resource.Adds theAttributeAccess.Flag.RESTART_ALL_SERVICESflag and removes any conflicting flag.Adds theAttributeAccess.Flag.RESTART_JVMflag and removes any conflicting flag.Adds theAttributeAccess.Flag.RUNTIME_SERVICE_NOT_REQUIREDflag.setStability(Stability stability) Defines the stability level of the feature enabled by this attribute.Adds theAttributeAccess.Flag.STORAGE_RUNTIMEflag and removes any conflicting flag.setUndefinedMetricValue(org.jboss.dmr.ModelNode undefinedMetricValue) Sets adefault valueto use for the metric if no runtime value is available (e.g. we are a server running in admin-only mode).setValidator(ParameterValidator validator) Sets the validator that should be used to validate attribute values.setXmlName(String xmlName) Sets thexml namefor the attribute, which is only needed if the name used for the attribute is different from its ordinaryname in the model.
-
Constructor Details
-
AbstractAttributeDefinitionBuilder
Creates a builder for an attribute with the give name and type. Equivalent toAbstractAttributeDefinitionBuilder(attributeName, type, false -
AbstractAttributeDefinitionBuilder
public AbstractAttributeDefinitionBuilder(String attributeName, org.jboss.dmr.ModelType type, boolean optional) Creates a builder for an attribute with the give name and type and nullability setting.- Parameters:
attributeName- thenameof the attribute. Cannot benulltype- thetypeof the attribute. Cannot benulloptional-trueif the attributeallows undefined valuesin the absence ofalternatives
-
AbstractAttributeDefinitionBuilder
Creates a builder populated with the values of an existing attribute definition.- Parameters:
basis- the existing attribute definition. Cannot benull
-
AbstractAttributeDefinitionBuilder
Creates a builder populated with the values of an existing attribute definition, with an optional change of the attribute's name.- Parameters:
attributeName- thenameof the attribute, ornullif the name frombasisshould be usedbasis- the existing attribute definition. Cannot benull
-
-
Method Details
-
build
Create theAttributeDefinition- Returns:
- the attribute definition. Will not return
null
-
setXmlName
Sets thexml namefor the attribute, which is only needed if the name used for the attribute is different from its ordinaryname in the model. If not set the default value is the name passed to the builder constructor.- Parameters:
xmlName- the xml name.nullis allowed- Returns:
- a builder that can be used to continue building the attribute definition
-
setRequired
Sets whether the attribute shouldrequire a defined valuein the absence ofalternatives. If not set the default value is the value provided to the builder constructor, ortrueif no value is provided.- Parameters:
required-trueif undefined values should not be allowed in the absence of alternatives- Returns:
- a builder that can be used to continue building the attribute definition
-
setAllowExpression
Sets whether the attribute shouldallow expressionsIf not set the default value isfalse.- Parameters:
allowExpression-trueif expression values should be allowed- Returns:
- a builder that can be used to continue building the attribute definition
-
setDefaultValue
Sets adefault valueto use for the attribute if no user-provided value is available.- Parameters:
defaultValue- the default value, ornullif no default should be used- Returns:
- a builder that can be used to continue building the attribute definition
-
setMeasurementUnit
Sets ameasurement unitto describe the unit in which a numeric attribute is expressed.- Parameters:
unit- the unit.nullis allowed- Returns:
- a builder that can be used to continue building the attribute definition
-
setCorrector
Sets aParameterCorrectorto use to adjust any user provided values beforevalidationoccurs.- Parameters:
corrector- the corrector. May benull- Returns:
- a builder that can be used to continue building the attribute definition
-
setValidator
Sets the validator that should be used to validate attribute values. The resulting attribute definition will wrap this validator in one that enforces the attribute'sallow nullandallow expressionsettings, so the givenvalidatorneed not be properly configured for those validations.- Parameters:
validator- the validator.nullis allowed- Returns:
- a builder that can be used to continue building the attribute definition
-
setAlternatives
Setsnames of alternative attributesthat should not be defined if this attribute is defined.- Parameters:
alternatives- the attribute names- Returns:
- a builder that can be used to continue building the attribute definition
-
addAlternatives
Addsnames of alternative attributesthat should not be defined if this attribute is defined.- Parameters:
alternatives- the attribute names- Returns:
- a builder that can be used to continue building the attribute definition
-
removeAlternatives
Removesnames of alternative attributesfrom the set of those that should not be defined if this attribute is defined.- Parameters:
alternatives- the attribute names- Returns:
- a builder that can be used to continue building the attribute definition
-
addArbitraryDescriptor
Addsarbitrary descriptor.- Parameters:
arbitraryDescriptor- the arbitrary descriptor name.value- the value of the arbitrary descriptor.- Returns:
- a builder that can be used to continue building the attribute definition
-
getArbitraryDescriptors
-
setRequires
Setsnames of required attributesthat must be defined if this attribute is defined.- Parameters:
requires- the attribute names- Returns:
- a builder that can be used to continue building the attribute definition
-
setFlags
Sets thespecial purpose flagsthat are relevant to the attribute- Parameters:
flags- the flags- Returns:
- a builder that can be used to continue building the attribute definition
-
addFlag
Adds aspecial purpose flagthat is relevant to the attribute- Parameters:
flag- the flag- Returns:
- a builder that can be used to continue building the attribute definition
-
removeFlag
Removes aspecial purpose flagfrom the set of those relevant to the attribute- Parameters:
flag- the flag- Returns:
- a builder that can be used to continue building the attribute definition
-
isFlagPresent
Checks if aspecial purpose flaghas been recorded as relevant to the attribute- Parameters:
flag- the flag- Returns:
- a builder that can be used to continue building the attribute definition
-
setStorageRuntime
Adds theAttributeAccess.Flag.STORAGE_RUNTIMEflag and removes any conflicting flag.- Returns:
- a builder that can be used to continue building the attribute definition
-
setRuntimeServiceNotRequired
Adds theAttributeAccess.Flag.RUNTIME_SERVICE_NOT_REQUIREDflag.- Returns:
- a builder that can be used to continue building the attribute definition
-
setRestartAllServices
Adds theAttributeAccess.Flag.RESTART_ALL_SERVICESflag and removes any conflicting flag.- Returns:
- a builder that can be used to continue building the attribute definition
-
setRestartJVM
Adds theAttributeAccess.Flag.RESTART_JVMflag and removes any conflicting flag.- Returns:
- a builder that can be used to continue building the attribute definition
-
setMaxSize
Sets a maximum size for a collection-type attribute or one whose value is a string or byte[]. The value represents the maximum number of elements in the collection, or the maximum length of the string or array. It does not represent a maximum value for a numeric attribute and should not be configured for numeric attributes.- Parameters:
maxSize- the maximum size- Returns:
- a builder that can be used to continue building the attribute definition
-
setMinSize
Sets a minimum size description for a collection-type attribute or one whose value is a string or byte[]. The value represents the minimum number of elements in the collection, or the minimum length of the string or array. It does not represent a minimum value for a numeric attribute and should not be configured for numeric attributes.- Parameters:
minSize- the minimum size- Returns:
- a builder that can be used to continue building the attribute definition
-
setAttributeMarshaller
Sets a customAttributeMarshallerto use for marshalling the attribute to xml. If not set, aDefaultAttributeMarshallerwill be used.- Parameters:
marshaller- the marshaller. Can benull- Returns:
- a builder that can be used to continue building the attribute definition
-
setAttributeParser
Sets a customAttributeParserto use for parsing attribute from xml. If not set, aAttributeParser.SIMPLEwill be used.- Parameters:
parser- the parser. Can benull- Returns:
- a builder that can be used to continue building the attribute definition
-
setResourceOnly
Marks an attribute as only relevant to a resource, and not a valid parameter to an "add" operation that creates that resource. Typically used for legacy "name" attributes that display the final value in the resource's address as an attribute.- Returns:
- a builder that can be used to continue building the attribute definition
-
setDeprecated
Marks the attribute as deprecated since the given API version. This is equivalent to callingsetDeprecated(ModelVersion, boolean)with thenotificationUsefulparameter set totrue.- Parameters:
since- the API version, with the API being the one (core or a subsystem) in which the attribute is used- Returns:
- a builder that can be used to continue building the attribute definition
-
setDeprecated
Marks the attribute as deprecated since the given API version, with the ability to configure that notifications to the user (e.g. via a log message) about deprecation of the attribute should not be emitted. Notifying the user should only be done if the user can take some action in response. Advising that something will be removed in a later release is not useful if there is no alternative in the current release. If thenotificationUsefulparam istruethe text description of the attribute deprecation available from theread-resource-descriptionmanagement operation should provide useful information about how the user can avoid using the attribute.- Parameters:
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 useful- Returns:
- a builder that can be used to continue building the attribute definition
-
setExpressionsDeprecated
Marks that support for use of an expression for the attribute's value is deprecated and may be removed in a future release.- Returns:
- a builder that can be used to continue building the attribute definition
-
setAccessConstraints
Sets access constraints to use with the attribute- Parameters:
accessConstraints- the constraints- Returns:
- a builder that can be used to continue building the attribute definition
-
addAccessConstraint
Adds an access constraint to the set used with the attribute- Parameters:
accessConstraint- the constraint- Returns:
- a builder that can be used to continue building the attribute definition
-
setNullSignificant
Sets whether an access control check is required to implicitly set an attribute toundefinedin 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 attributeAttributeDefinition.isRequired()() is not required} and has adefault value.- Parameters:
nullSignificant-trueif an undefined value is significant;falseif it is not significant, even if a default value is configured- Returns:
- a builder that can be used to continue building the attribute definition
-
setAttributeGroup
Sets the name of the attribute group with which this attribute is associated.- Parameters:
attributeGroup- the attribute group name. Cannot be an empty string but can benullif the attribute is not associated with a group.- Returns:
- a builder that can be used to continue building the attribute definition
-
setAllowedValues
Sets allowed values for attribute- Parameters:
allowedValues- values that are legal as part in this attribute- Returns:
- a builder that can be used to continue building the attribute definition
-
setAllowedValues
Sets allowed values for attribute- Parameters:
allowedValues- values that are legal as part in this attribute- Returns:
- a builder that can be used to continue building the attribute definition
-
setAllowedValues
Sets allowed values for attribute- Parameters:
allowedValues- values that are legal as part in this attribute- Returns:
- a builder that can be used to continue building the attribute definition
-
setCapabilityReference
public BUILDER setCapabilityReference(String referencedCapability, RuntimeCapability<?> dependentCapability) Records that this attribute's value represents a reference to an instance of adynamic capability.This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)passing in aCapabilityReferenceRecorder.DefaultCapabilityReferenceRecorderconstructed using the parameters passed to this method.- Parameters:
referencedCapability- the name of the dynamic capability the dynamic portion of whose name is represented by the attribute's valuedependentCapability- the capability that depends onreferencedCapability- Returns:
- the builder
- See Also:
-
setCapabilityReference
Records that this attribute's value represents a reference to an instance of adynamic capability.This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)passing in aCapabilityReferenceRecorder.ContextDependencyRecorderconstructed using the parameters passed to this method.NOTE: This method of recording capability references is only suitable for use in attributes only used in resources that themselves expose a single capability. If your resource exposes more than single you should use
setCapabilityReference(RuntimeCapability, String, AttributeDefinition...)variant When the capability requirement is registered, the dependent capability will be that capability.- Parameters:
referencedCapability- the name of the dynamic capability the dynamic portion of whose name is represented by the attribute's value- Returns:
- the builder
- See Also:
-
setCapabilityReference
public BUILDER setCapabilityReference(String referencedCapability, AttributeDefinition... dependantAttributes) Records that this attribute's value represents a reference to an instance of adynamic capability.This method is a convenience method equivalent to calling *
setCapabilityReference(CapabilityReferenceRecorder)passing in aCapabilityReferenceRecorder.CompositeAttributeDependencyRecorderconstructed using the parameters passed to this method.NOTE: This method of recording capability references is only suitable for use in attributes only used in resources that themselves expose a single capability. If your resource exposes more than single capability, you should use
setCapabilityReference(RuntimeCapability, String, AttributeDefinition...)When the capability requirement is registered, the dependent capability will be that capability.- Parameters:
referencedCapability- the name of the dynamic capability the dynamic portion of whose name is represented by the attribute's valuedependantAttributes- attribute from same resource that will be used to derive multiple dynamic parts for the dependant capability- Returns:
- the builder
- See Also:
-
setCapabilityReference
public BUILDER setCapabilityReference(RuntimeCapability capability, String referencedCapability, AttributeDefinition... dependantAttributes) Records that this attribute's value represents a reference to an instance of adynamic capability.This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)passing in aCapabilityReferenceRecorder.CompositeAttributeDependencyRecorderconstructed using the parameters passed to this method.When the capability requirement is registered, the dependent capability will be that capability.
- Parameters:
capability- requirement capabilityreferencedCapability- the name of the dynamic capability the dynamic portion of whose name is represented by the attribute's valuedependantAttributes- attributes on resource which will be used for registering capability reference, can be multiple.- Returns:
- the builder
- See Also:
-
setCapabilityReference
Records that this attribute's value represents a reference to an instance of adynamic capability.This method is a convenience method equivalent to calling
setCapabilityReference(CapabilityReferenceRecorder)passing in aCapabilityReferenceRecorder.DefaultCapabilityReferenceRecorderconstructed using the parameters passed to this method.- Parameters:
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 onreferencedCapability- Returns:
- the builder
- See Also:
-
setCapabilityReference
Records that this attribute's value represents a reference to an instance of adynamic capabilityand assigns the object that should be used to handle adding and removing capability requirements.- Parameters:
referenceRecorder- recorder to handle adding and removing capability requirements. May benull- Returns:
- the builder
- See Also:
-
setUndefinedMetricValue
Sets adefault valueto use for the metric if no runtime value is available (e.g. we are a server running in admin-only mode).- Parameters:
undefinedMetricValue- the default value, ornullif no default should be used- Returns:
- a builder that can be used to continue building the attribute definition
-
setStability
Defines the stability level of the feature enabled by this attribute.- Parameters:
stability- a stability level- Returns:
- a reference to this builder
-
getName
-
getType
public org.jboss.dmr.ModelType getType() -
getXmlName
-
isNillable
public boolean isNillable() -
isAllowExpression
public boolean isAllowExpression() -
getDefaultValue
public org.jboss.dmr.ModelNode getDefaultValue() -
getMeasurementUnit
-
getAlternatives
-
getRequires
-
getCorrector
-
getValidator
-
getMinSize
public int getMinSize() -
getMaxSize
public int getMaxSize() -
getFlags
-
getAttributeMarshaller
-
isResourceOnly
public boolean isResourceOnly() -
getDeprecated
-
getAccessConstraints
-
getNullSignificant
-
getUndefinedMetricValue
public org.jboss.dmr.ModelNode getUndefinedMetricValue() -
getParser
-
getAttributeGroup
-
getAllowedValues
public org.jboss.dmr.ModelNode[] getAllowedValues() -
getCapabilityReferenceRecorder
-
getStability
-