List of usage examples for java.lang Class equals
public boolean equals(Object obj)
From source file:org.openmrs.module.restrictbyuser.UserRestrictionValidator.java
public boolean supports(Class c) { return c.equals(UserRestriction.class); }
From source file:com.tmind.framework.pub.utils.MethodUtils.java
/** * <p>Determine whether a type can be used as a parameter in a method invocation. * This method handles primitive conversions correctly.</p> * * <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>, * a <code>Long</code> to a <code>long</code>, * a <code>Float</code> to a <code>float</code>, * a <code>Integer</code> to a <code>int</code>, * and a <code>Double</code> to a <code>double</code>. * Now logic widening matches are allowed. * For example, a <code>Long</code> will not match a <code>int</code>. * * @param parameterType the type of parameter accepted by the method * @param parameterization the type of parameter being tested * * @return true if the assignement is compatible. *//*from w w w. java 2s . c o m*/ public static final boolean isAssignmentCompatible(Class parameterType, Class parameterization) { // try plain assignment if (parameterType.isAssignableFrom(parameterization)) { return true; } if (parameterType.isPrimitive()) { // this method does *not* do widening - you must specify exactly // is this the right behaviour? Class parameterWrapperClazz = getPrimitiveWrapper(parameterType); if (parameterWrapperClazz != null) { return parameterWrapperClazz.equals(parameterization); } } return false; }
From source file:org.openmrs.reporting.PatientCharacteristicFilterValidator.java
@SuppressWarnings("unchecked") public boolean supports(Class cls) { return (cls.equals(PatientCharacteristicFilter.class)); }
From source file:org.openmrs.reporting.DrugOrderPatientFilterValidator.java
@SuppressWarnings("unchecked") public boolean supports(Class cls) { return (cls.equals(DrugOrderPatientFilter.class)); }
From source file:ca.oson.json.util.ObjectUtil.java
public static boolean isTypeOf(String myClass, Class<?> superClass) { boolean isSubclassOf = false; try {/*w w w. java2 s. c o m*/ Class<?> clazz = Class.forName(myClass); if (!clazz.equals(superClass)) { clazz = clazz.getSuperclass(); isSubclassOf = isTypeOf(clazz.getName(), superClass); } else { isSubclassOf = true; } } catch (ClassNotFoundException e) { /* Ignore */ } return isSubclassOf; }
From source file:org.guanxi.sp.engine.form.RegisterIdPFormValidator.java
@SuppressWarnings("unchecked") public boolean supports(Class clazz) { return clazz.equals(RegisterIdP.class); }
From source file:com.apress.progwt.server.web.domain.validation.MailingListCommandValidator.java
public boolean supports(Class clazz) { return clazz.equals(MailingListCommand.class); }
From source file:com.roadrantz.mvc.RantValidator.java
public boolean supports(Class clazz) { return clazz.equals(Rant.class); }
From source file:com.springframework.core.annotation.AnnotationUtils.java
/** * Find the first {@link Class} in the inheritance hierarchy of the specified {@code clazz} * (including the specified {@code clazz} itself) which declares an annotation for the * specified {@code annotationType}, or {@code null} if not found. If the supplied * {@code clazz} is {@code null}, {@code null} will be returned. * <p>If the supplied {@code clazz} is an interface, only the interface itself will be checked; * the inheritance hierarchy for interfaces will not be traversed. * <p>Meta-annotations will <em>not</em> be searched. * <p>The standard {@link Class} API does not provide a mechanism for determining which class * in an inheritance hierarchy actually declares an {@link Annotation}, so we need to handle * this explicitly./* ww w .ja v a2s.c om*/ * @param annotationType the annotation type to look for, both locally and as a meta-annotation * @param clazz the class on which to check for the annotation (may be {@code null}) * @return the first {@link Class} in the inheritance hierarchy of the specified {@code clazz} * which declares an annotation of the specified {@code annotationType}, or {@code null} * if not found * @see Class#isAnnotationPresent(Class) * @see Class#getDeclaredAnnotations() * @see #findAnnotationDeclaringClassForTypes(List, Class) * @see #isAnnotationDeclaredLocally(Class, Class) */ public static Class<?> findAnnotationDeclaringClass(Class<? extends Annotation> annotationType, Class<?> clazz) { Assert.notNull(annotationType, "Annotation type must not be null"); if (clazz == null || clazz.equals(Object.class)) { return null; } if (isAnnotationDeclaredLocally(annotationType, clazz)) { return clazz; } return findAnnotationDeclaringClass(annotationType, clazz.getSuperclass()); }
From source file:com.geminimobile.web.SearchValidator.java
@SuppressWarnings("unchecked") public boolean supports(Class clazz) { return clazz.equals(SearchCommand.class); }