From cb31194cb1323a5c021622b94a189aaaf53cfcab Mon Sep 17 00:00:00 2001 From: Tom Page Date: Mon, 24 Jul 2017 15:53:35 +0100 Subject: [PATCH] RM-5420 Code review fixes including move toIndentedString into a helper method. --- .../java/org/alfresco/util/StringUtils.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java new file mode 100644 index 0000000000..829c03c197 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java @@ -0,0 +1,51 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.util; + +/** + * String utility methods. + * + * @author Tom Page + * @since 2.6 + */ +public class StringUtils +{ + /** Private constructor for the helper class. */ + private StringUtils() {} + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + public static String toIndentedString(Object o) + { + if (o == null) + { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +}