001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.core.style; 018 019/** 020 * Simple utility class to allow for convenient access to value 021 * styling logic, mainly to support descriptive logging messages. 022 * 023 * <p>For more sophisticated needs, use the {@link ValueStyler} abstraction 024 * directly. This class simply uses a shared {@link DefaultValueStyler} 025 * instance underneath. 026 * 027 * @author Keith Donald 028 * @since 1.2.2 029 * @see ValueStyler 030 * @see DefaultValueStyler 031 */ 032public abstract class StylerUtils { 033 034 /** 035 * Default ValueStyler instance used by the {@code style} method. 036 * Also available for the {@link ToStringCreator} class in this package. 037 */ 038 static final ValueStyler DEFAULT_VALUE_STYLER = new DefaultValueStyler(); 039 040 /** 041 * Style the specified value according to default conventions. 042 * @param value the Object value to style 043 * @return the styled String 044 * @see DefaultValueStyler 045 */ 046 public static String style(Object value) { 047 return DEFAULT_VALUE_STYLER.style(value); 048 } 049 050}