You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "João Paulo Lemes Machado (JIRA)" <ji...@apache.org> on 2017/07/16 14:30:00 UTC

[jira] [Comment Edited] (LOG4J2-1979) Refactoring of StrSubstitutor

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

João Paulo Lemes Machado edited comment on LOG4J2-1979 at 7/16/17 2:29 PM:
---------------------------------------------------------------------------

I've also found refactoring opportunities in other classes. Would you mind if I created other issues to discuss about them?
The recommendation will be very similar, changing the list of methods and class names. The other classes may not have this dependency problem as the StrSubstitutor.


was (Author: joaoplm):
I've also found refactoring opportunities in other classes. Would you mind if I created other issues to discuss about them?
The recommendation will be very similar, changing the list of methods and class names. The other classes may not have this dependency problem as the SubstringString.

> 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)