ReadablePartialPrinter.java 1.5 KB
Newer Older
1
/*
2
 * Copyright 2002-2013 the original author or authors.
3 4 5 6 7
 *
 * Licensed 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
 *
S
Spring Operator 已提交
8
 *      https://www.apache.org/licenses/LICENSE-2.0
9 10 11 12 13 14 15
 *
 * 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.
 */
J
Juergen Hoeller 已提交
16

17
package org.springframework.format.datetime.joda;
18 19 20

import java.util.Locale;

21 22
import org.joda.time.ReadablePartial;
import org.joda.time.format.DateTimeFormatter;
J
Juergen Hoeller 已提交
23

24
import org.springframework.format.Printer;
25 26

/**
27
 * Prints Joda-Time {@link ReadablePartial} instances using a {@link DateTimeFormatter}.
J
Juergen Hoeller 已提交
28
 *
29
 * @author Keith Donald
K
Keith Donald 已提交
30
 * @since 3.0
31
 * @deprecated as of 5.3, in favor of standard JSR-310 support
32
 */
B
Brian Clozel 已提交
33
@Deprecated
34
public final class ReadablePartialPrinter implements Printer<ReadablePartial> {
35

36 37
	private final DateTimeFormatter formatter;

38

39
	/**
J
Juergen Hoeller 已提交
40
	 * Create a new ReadableInstantPrinter.
41 42 43 44
	 * @param formatter the Joda DateTimeFormatter instance
	 */
	public ReadablePartialPrinter(DateTimeFormatter formatter) {
		this.formatter = formatter;
45 46
	}

47

48
	@Override
49 50 51
	public String print(ReadablePartial partial, Locale locale) {
		return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(partial);
	}
J
Juergen Hoeller 已提交
52

53
}