You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by janmaterne <gi...@git.apache.org> on 2014/10/17 22:22:25 UTC

[GitHub] commons-lang pull request: Multiline recursive to string style

GitHub user janmaterne opened a pull request:

    https://github.com/apache/commons-lang/pull/34

    Multiline recursive to string style

    Works with ToStringBuilder to create a "deep" toString(). 
    But instead a single line like the RecursiveToStringStyle this creates a multiline String similar to the ToStringStyle.MultiLineToStringStyle.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/janmaterne/commons-lang MultilineRecursiveToStringStyle

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #34
    
----
commit 2c3af29b45054679fe105ed8bcb1f7a4ada38fbb
Author: Jan Matèrne <ja...@materne.de>
Date:   2014-10-17T19:55:43Z

    New ToStringStyle creating a multi-line recursive output.

commit 764e4b4663842192f7b6e9d29746a16cfa0f97fa
Author: Jan Matèrne <ja...@materne.de>
Date:   2014-10-17T20:19:01Z

    forgot to format the test

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[GitHub] commons-lang pull request: Multiline recursive to string style

Posted by janmaterne <gi...@git.apache.org>.
Github user janmaterne commented on the pull request:

    https://github.com/apache/commons-lang/pull/34#issuecomment-154367374
  
    Very good to hear!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request: Multiline recursive to string style

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/commons-lang/pull/34


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[GitHub] commons-lang pull request: Multiline recursive to string style

Posted by britter <gi...@git.apache.org>.
Github user britter commented on the pull request:

    https://github.com/apache/commons-lang/pull/34#issuecomment-153749334
  
    It has already been made public. The change will be released in 3.5, probably before the end of the year.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request: Multiline recursive to string style

Posted by mcint <gi...@git.apache.org>.
Github user mcint commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/34#discussion_r43829569
  
    --- Diff: src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java ---
    @@ -0,0 +1,218 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + * 
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + * 
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.commons.lang3.builder;
    +
    +import org.apache.commons.lang3.ClassUtils;
    +import org.apache.commons.lang3.SystemUtils;
    +
    +/**
    + * <p>Works with {@link ToStringBuilder} to create a "deep" <code>toString</code>. 
    + * But instead a single line like the {@link RecursiveToStringStyle} this creates a multiline String 
    + * similar to the {@link ToStringStyle.MultiLineToStringStyle}.</p>
    + * 
    + * <p>To use this class write code as follows:</p>
    + *
    + * <pre>
    + * public class Job {
    + *   String title;
    + *   ...
    + * }
    + * 
    + * public class Person {
    + *   String name;
    + *   int age;
    + *   boolean smoker;
    + *   Job job;
    + * 
    + *   ...
    + * 
    + *   public String toString() {
    + *     return new ReflectionToStringBuilder(this, new MultilineRecursiveToStringStyle()).toString();
    + *   }
    + * }
    + * </pre>
    + *
    + * <p>
    + * This will produce a toString of the format:<br>
    + * <code>Person@7f54[ <br>
    + * &nbsp; name=Stephen, <br>
    + * &nbsp; age=29, <br>
    + * &nbsp; smoker=false, <br>
    + * &nbsp; job=Job@43cd2[ <br>
    + * &nbsp; &nbsp; title=Manager <br>
    + * &nbsp;  ] <br>
    + * ]
    + * </code>
    + * </p>
    + * 
    + * @since 3.4
    + */
    +class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
    --- End diff --
    
    Should this have been public? I've been trying to use this class, but can neither import it nor find a factory method that might give me an instance of the class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---