class Athena::Validator::Metadata::ClassMetadata(T)
- Athena::Validator::Metadata::ClassMetadata(T)
- Reference
- Object
Overview
Represents metadata associated with an AVD::Validatable
instance.
self
is lazily initialized and cached at the class level.
Includes metadata about the class; such as its name, constraints, etc.
Included Modules
Defined in:
metadata/class_metadata.crConstructors
-
.build : self
Builds
self
, auto registering any annotation based annotations onT
, as well as those registered viaT.load_metadata
. - .new
Instance Method Summary
-
#add_constraint(constraints : Array(AVD::Constraint)) : self
Adds each of the provided constraints to
self
. -
#add_constraint(constraint : AVD::Constraint) : self
Adds the provided constraint to
self
's#constraints
array. -
#add_getter_constraint(method_name : String, constraint : AVD::Constraint) : self
Adds the provided constraint to the provided method_name.
-
#add_property_constraint(property_name : String, constraints : Array(AVD::Constraint)) : self
Adds each of the provided constraints to the provided property_name.
-
#add_property_constraint(property_name : String, constraint : AVD::Constraint) : self
Adds the provided constraint to the provided property_name.
-
#add_property_constraints(property_hash : Hash(String, AVD::Constraint | Array(AVD::Constraint))) : self
Adds a hash of constraints to
self
, where the keys represent the property names, and the value is the constraint/array of constraints to add. - #class_name : T.class
-
#constrained_properties : Array(String)
Returns an array of the properties who
self
has constraints defined for. -
#default_group : String
The
#class_name
based group forself
. -
#group_sequence : AVD::Constraints::GroupSequence | Nil
The
AVD::Constraints::GroupSequence
used byself
, if any. -
#group_sequence=(sequence : Array(String) | AVD::Constraints::GroupSequence) : self
Sets the
AVD::Constraints::GroupSequence
that should be used forself
. -
#group_sequence_provider=(active : Bool) : Nil
Denotes
self
as aAVD::Constraints::GroupSequence::Provider
. -
#has_property_metadata?(property_name : String) : Bool
Returns
true
ifself
has property metadata for the provided property_name. - #name : String | Nil
-
#property_metadata(property_name : String) : Array(AVD::Metadata::PropertyMetadataInterface)
Returns an
AVD::Metadata::PropertyMetadataInterface
instance for the provided property_name, if any.
Instance methods inherited from module Athena::Validator::Metadata::GenericMetadata
add_constraint(constraint : AVD::Constraint) : AVD::Metadata::GenericMetadata
add_constraint,
add_constraints(constraints : Array(AVD::Constraint)) : AVD::Metadata::GenericMetadata
add_constraints,
cascading_strategy : AVD::Metadata::CascadingStrategy
cascading_strategy,
constraints : Array(AVD::Constraint)
constraints,
find_constraints(group : String) : Array(AVD::Constraint)
find_constraints
Instance methods inherited from module Athena::Validator::Metadata::MetadataInterface
cascading_strategy : AVD::Metadata::CascadingStrategy
cascading_strategy,
constraints : Array(AVD::Constraint)
constraints,
find_constraints(group : String) : Array(AVD::Constraint)
find_constraints
Constructor Detail
Builds self
, auto registering any annotation based annotations on T
,
as well as those registered via T.load_metadata
.
Instance Method Detail
Adds each of the provided constraints to self
.
Adds the provided constraint to self
's #constraints
array.
Sets #cascading_strategy
to AVD::Metadata::CascadingStrategy::Cascade
if the constraint is AVD::Constraints::Valid
.
Also adds the #class_name
based group via AVD::Constraint#add_implicit_group
.
Adds the provided constraint to the provided method_name.
Adds each of the provided constraints to the provided property_name.
Adds the provided constraint to the provided property_name.
Adds a hash of constraints to self
, where the keys represent the property names, and the value
is the constraint/array of constraints to add.
Returns an array of the properties who self
has constraints defined for.
The AVD::Constraints::GroupSequence
used by self
, if any.
Sets the AVD::Constraints::GroupSequence
that should be used for self
.
Raises an ArgumentError
if self
is an AVD::Constraints::GroupSequence::Provider
,
the sequence contains AVD::Constraint::DEFAULT_GROUP
,
or the #class_name
based group is missing.
Denotes self
as a AVD::Constraints::GroupSequence::Provider
.
Returns true
if self
has property metadata for the provided property_name.
Returns an AVD::Metadata::PropertyMetadataInterface
instance for the provided property_name, if any.