View Javadoc
1 /* 2 * Copyright (c) 2002-2003 The XDoclet Team. 3 * All rights reserved. 4 */ 5 package xdoclet.util.predicates; 6 7 import org.apache.commons.collections.Predicate; 8 9 import xjavadoc.XClass; 10 11 /*** 12 * @todo move to xjavadoc 13 * 14 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a> 15 * @version $Revision: 1.6 $ 16 */ 17 public class IsA implements Predicate { 18 private String _className; 19 20 /*** Constructs a new IsA. */ 21 public IsA() { 22 } 23 24 /*** 25 * Constructs a new IsA. 26 * 27 * @param className the name of the class to evaluate against 28 */ 29 public IsA(String className) { 30 setClassName(className); 31 } 32 33 /*** 34 * Sets the name of the class to evaluate against. 35 * @param className the name of the class to evaluate against 36 */ 37 public void setClassName(String className) { 38 _className = className; 39 } 40 41 public final boolean evaluate(Object o) { 42 if (!(o instanceof XClass)) { 43 throw new IllegalArgumentException("o must be of type XClass, but was: " + o.getClass().getName()); 44 } 45 46 XClass clazz = (XClass) o; 47 48 return clazz.isA(_className); 49 } 50 }

This page was automatically generated by Maven