KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > style > ToStringStyler


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.core.style;
18
19 /**
20  * A strategy interface for pretty-printing <code>toString()</code> methods.
21  * Encapsulates the print algorithms; some other object such as a builder
22  * should provide the workflow.
23  *
24  * @author Keith Donald
25  * @since 1.2.2
26  */

27 public interface ToStringStyler {
28
29     /**
30      * Style a <code>toString()</code>'ed object before its fields are styled.
31      * @param buffer the buffer to print to
32      * @param obj the object to style
33      */

34     void styleStart(StringBuffer JavaDoc buffer, Object JavaDoc obj);
35
36     /**
37      * Style a <code>toString()</code>'ed object after it's fields are styled.
38      * @param buffer the buffer to print to
39      * @param obj the object to style
40      */

41     void styleEnd(StringBuffer JavaDoc buffer, Object JavaDoc obj);
42
43     /**
44      * Style a field value as a string.
45      * @param buffer the buffer to print to
46      * @param fieldName the he name of the field
47      * @param value the field value
48      */

49     void styleField(StringBuffer JavaDoc buffer, String JavaDoc fieldName, Object JavaDoc value);
50
51     /**
52      * Style the given value.
53      * @param buffer the buffer to print to
54      * @param value the field value
55      */

56     void styleValue(StringBuffer JavaDoc buffer, Object JavaDoc value);
57
58     /**
59      * Style the field separator.
60      * @param buffer buffer to print to
61      */

62     void styleFieldSeparator(StringBuffer JavaDoc buffer);
63
64 }
65
Popular Tags