[ 
https://issues.apache.org/jira/browse/LOG4J2-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16088569#comment-16088569
 ] 

João Paulo Lemes Machado commented on LOG4J2-1979:
--------------------------------------------------

Thanks everyone for the comments, I did not realize that this class had this 
addiction problem. What do you think about this kind of refactoring? Is it 
something you would do if there was no such problem?

> Refactoring of StrSubstitutor
> -----------------------------
>
>                 Key: LOG4J2-1979
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1979
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>            Reporter: João Paulo Lemes Machado
>
> Hello everyone.
> I was analyzing the modularization of some classes, and I identified that the 
> class StrSubstitutor has an opportunity for cohesion improvement. 
> The class ParameterizedMessage was in the same situation and the problem was 
> solved as follows: The ParameterFormatter class was created, and several 
> get() and set() methods that were used only to configure the class parameters 
> were moved from ParameterizedMessage to ParameterFormatter. 
> The new class was then accessed through an instance variable in 
> ParameterizedMessage. This strategy has cleaned and improved 
> ParameterizedMessage cohesion.
> With this in mind, I would recommend creating a new class: 
> StrSubstitutorConfig , and moving the following methods:
> setVariableSuffixMatcher
> setEscapeChar
> getValueDelimiterMatcher
> setVariableSuffix
> setValueDelimiter
> setVariableResolver
> getVariableResolver
> getVariablePrefixMatcher
> setVariablePrefix
> setVariableSuffix
> setValueDelimiter
> setEnableSubstitutionInVariables
> setConfiguration
> setVariablePrefix
> getVariableSuffixMatcher
> getChars
> setVariablePrefixMatcher
> setValueDelimiterMatcher
> getEscapeChar
> from the StrSubstitutor.
> Those parameters accessed by an instance variable in the StrSubstitutor.
> Moreover, the orthogonality is the design would be enhanced.
> What do you think about that?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to