ValueObject

Trait ValueObject 

Source
pub trait ValueObject:
    Debug
    + Send
    + Sync {
    // Required methods
    fn attribute_type(&self) -> AttributeType;
    fn attribute_name(&self) -> &str;
    fn to_json(&self) -> ValidationResult<Value>;
    fn validate_against_schema(
        &self,
        definition: &AttributeDefinition,
    ) -> ValidationResult<()>;
    fn as_json_value(&self) -> Value;
    fn supports_definition(&self, definition: &AttributeDefinition) -> bool;
    fn clone_boxed(&self) -> Box<dyn ValueObject>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Core trait for all SCIM value objects.

This trait enables dynamic value object operations while maintaining type safety through the use of Any for downcasting when needed.

Required Methods§

Source

fn attribute_type(&self) -> AttributeType

Get the SCIM attribute type this value object represents

Source

fn attribute_name(&self) -> &str

Get the schema attribute name this value object corresponds to

Source

fn to_json(&self) -> ValidationResult<Value>

Serialize the value object to JSON

Source

fn validate_against_schema( &self, definition: &AttributeDefinition, ) -> ValidationResult<()>

Validate the value object against a schema definition

Source

fn as_json_value(&self) -> Value

Get the raw value as a JSON Value for schema-agnostic operations

Source

fn supports_definition(&self, definition: &AttributeDefinition) -> bool

Check if this value object supports the given attribute definition

Source

fn clone_boxed(&self) -> Box<dyn ValueObject>

Clone the value object as a boxed trait object

Source

fn as_any(&self) -> &dyn Any

Get type information for downcasting

Implementors§