Coverage Report - net.sf.json.processors.PropertyNameProcessorMatcher
 
Classes in this File Line Coverage Branch Coverage Complexity
PropertyNameProcessorMatcher
0%
0/3
N/A
2
PropertyNameProcessorMatcher$1
N/A
N/A
2
PropertyNameProcessorMatcher$DefaultPropertyNameProcessorMatcher
0%
0/4
0%
0/6
2
 
 1  
 /*
 2  
  * Copyright 2002-2009 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 net.sf.json.processors;
 18  
 
 19  
 import java.util.Set;
 20  
 
 21  
 /**
 22  
  * Base class for finding a matching PropertyNameProcessor.<br>
 23  
  * <ul>
 24  
  * <li>DEFAULT - matches the target class with equals().</li>
 25  
  * </ul>
 26  
  *
 27  
  * @author Andres Almiray <aalmiray@users.sourceforge.net>
 28  
  */
 29  0
 public abstract class PropertyNameProcessorMatcher {
 30  
    /** Matches the target with equals() */
 31  0
    public static final PropertyNameProcessorMatcher DEFAULT = new DefaultPropertyNameProcessorMatcher();
 32  
 
 33  
    /**
 34  
     * Returns the matching class calculated with the target class and the
 35  
     * provided set.
 36  
     *
 37  
     * @param target the target class to match
 38  
     * @param set a set of possible matches
 39  
     */
 40  
    public abstract Object getMatch( Class target, Set set );
 41  
 
 42  0
    private static final class DefaultPropertyNameProcessorMatcher extends PropertyNameProcessorMatcher {
 43  
       public Object getMatch( Class target, Set set ) {
 44  0
          if( target != null && set != null && set.contains( target ) ){
 45  0
             return target;
 46  
          }
 47  0
          return null;
 48  
       }
 49  
    }
 50  
 }