1 /*
2 * Copyright (c) 2010 Commsen International. All rights reserved.
3 *
4 * This file is part of JWebThumb library.
5 *
6 * JWebThumb library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * JWebThumb library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with JWebThumb library. If not, see <http://www.gnu.org/licenses/lgpl.html>.
18 */
19
20 package com.commsen.jwebthumb.simplexml;
21
22 import java.util.Date;
23
24 import org.simpleframework.xml.transform.Matcher;
25 import org.simpleframework.xml.transform.Transform;
26
27 /***
28 * Implementation of {@link Matcher} which attaches {@link DateTransformer} as default transformer
29 * for {@link Date} objects.
30 *
31 * @author <a href="mailto:MilenDyankov@gmail.com">Milen Dyankov</a>
32 * @since 0.3
33 */
34 public class JWebThumbMatcher implements Matcher {
35
36 /***
37 * @see org.simpleframework.xml.transform.Matcher#match(java.lang.Class)
38 */
39 @SuppressWarnings("unchecked")
40 public Transform match(Class type) throws Exception {
41 if (type.equals(Date.class)) return new DateTransformer();
42 return null;
43 }
44
45 }