1 /* 2 * Copyright 2007-2013 smartics, Kronseder & Reiner GmbH 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 package de.smartics.exceptions.report.qdox; 17 18 import com.thoughtworks.qdox.Searcher; 19 import com.thoughtworks.qdox.model.JavaClass; 20 21 import de.smartics.exceptions.core.Code; 22 import de.smartics.util.lang.NullArgumentException; 23 24 /** 25 * Filter catches classes that implement {@value #CODE_CLASS_NAME}. 26 */ 27 public final class ExceptionCodeSearcher implements Searcher 28 { 29 // ********************************* Fields ********************************* 30 31 // --- constants ------------------------------------------------------------ 32 33 /** 34 * The name of the code interface implemented by exception code classes. 35 */ 36 private static final String CODE_CLASS_NAME = Code.class.getName(); 37 38 // --- members -------------------------------------------------------------- 39 40 // ****************************** Initializer ******************************* 41 42 // ****************************** Constructors ****************************** 43 44 // ****************************** Inner Classes ***************************** 45 46 // ********************************* Methods ******************************** 47 48 // --- init ----------------------------------------------------------------- 49 50 // --- get&set -------------------------------------------------------------- 51 52 // --- business ------------------------------------------------------------- 53 54 /** 55 * {@inheritDoc} 56 * 57 * @see com.thoughtworks.qdox.Searcher#eval(com.thoughtworks.qdox.model.JavaClass) 58 * @throws NullArgumentException if {@code cls} is <code>null</code>. 59 */ 60 @Override 61 public boolean eval(final JavaClass cls) throws NullArgumentException 62 { 63 return cls.isEnum() && cls.isA(CODE_CLASS_NAME); 64 } 65 66 // --- object basics -------------------------------------------------------- 67 68 }