001/*
002 * Matcher.java May 2007
003 *
004 * Copyright (C) 2007, Niall Gallagher <niallg@users.sf.net>
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
015 * implied. See the License for the specific language governing 
016 * permissions and limitations under the License.
017 */
018
019package org.simpleframework.xml.transform;
020
021/**
022 * The <code>Matcher</code> is used to match a type with a transform
023 * such that a string value can be read or written as that type. If
024 * there is no match this will typically return a null to indicate
025 * that another matcher should be delegated to. If there is an error
026 * in performing the match an exception is thrown.
027 * 
028 * @author Niall Gallagher
029 * 
030 * @see org.simpleframework.xml.transform.Transformer
031 */
032public interface Matcher {
033
034   /**
035    * This is used to match a <code>Transform</code> using the type
036    * specified. If no transform can be acquired then this returns
037    * a null value indicating that no transform could be found.
038    * 
039    * @param type this is the type to acquire the transform for
040    * 
041    * @return returns a transform for processing the type given
042    */ 
043   Transform match(Class type) throws Exception;
044}