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

Bruno P. Kinoshita commented on TEXT-16:
----------------------------------------

>Looks promising to me. However we should try to make the ParseOptions 
>immutable. This can be achieved by using Collections.unmodifiableSet in the 
>getters.

+1 more or less like this?

https://git1-us-west.apache.org/repos/asf?p=commons-text.git;a=commitdiff;h=4310744eb62e735a39ff84840cd4eb41ae6eb5a6

> Create a new Parser instance based on the configuration of another one. The 
> use case for this is when you want to use the default options but with an 
> additional suffix

Would it be better something like A):

{noformat}
class HumanNameParser {

    /**
     * Constructor... takes another parser as parameter. The options of the 
other parser are used...
     * param other - another parser
    public HumanNameParser(HumanNameParser other) {
        this(other.getOptions());
    }

    // ..
}
{noformat}

Or something like B):

{noformat}
class HumanNameParser {

    public static HumanNameParser copy(HumanNameParser other) {
        // ...
    }

    // ..
}
{noformat}

> Create a new Parser from scratch

I think that's doable already? new HumanNameParser(), or passing options.

What do you think?

> Improve HumanNameParser
> -----------------------
>
>                 Key: TEXT-16
>                 URL: https://issues.apache.org/jira/browse/TEXT-16
>             Project: Commons Text
>          Issue Type: Improvement
>            Reporter: Bruno P. Kinoshita
>            Assignee: Benedikt Ritter
>            Priority: Minor
>              Labels: Refactoring
>
> From http://markmail.org/thread/da7ayocit2dl4otv
> - The constructor of the parser takes configuration options which can be
> reused for several names to parse
> - the parse method takes a string as parameter, containing a name
> - the parse method returns an immutable Name objects which has getters for
> firstName, lastName etc.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to