chibenwa commented on PR #2960:
URL: https://github.com/apache/james-project/pull/2960#issuecomment-4047379162

   > I would much prefer an hybrid approach where metadata which is actively 
used by james is materialized as such in the metadata object and accessed 
through structured accessors instead of iterating through a map comparing 
strings every time we need the information
   
   I propose:
    - Keeping the undlying data as (typed) `Map<String, String>`
    - Adding convenience factory methods for manipulating known value
    
    Essentially:
    
    ```
   record BlobMetadata(Map<BlobMetadataName, BlobMetadataValue> metadata) {
       public static BlobMetadata empty() {...}
       
       public ContentTransferEncoding contentTransferEncoding() {
           return 
ContentTransferEncoding.fromBlobMetadataValue(metatdata.get(BlobMetadataName.CONTENT_TRANSFER_ENCODING));
       }
       
       public BlobMetadata withMetadata(BlobMetadataName name, 
BlobMetadataValue value) {
           return new BlobMetadata(ImmutableList.builder()
               .putAll(metadata)
               .put(name, value)
               .build());
       }
       
       public BlobMetadata withContentTransferEncoding(ContentTransferEncoding 
encoding) {
           return withMetadata(BlobMetadataName.CONTENT_TRANSFER_ENCODING, 
encoding.asBlobMetadataValue());
       }
   }
   ```
   
   I think it keeps the underlying data model simple, extensible, easy to work 
with in DAOs, and it address your concerns and makes James used metadata a 
prime citizen.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to