Example usage for java.lang Class equals

List of usage examples for java.lang Class equals

Introduction

In this page you can find the example usage for java.lang Class equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:com.bstek.dorado.data.method.MethodAutoMatchingUtils.java

private static MethodInfo getMethodInfo(Method[] methods) {
    boolean classIsSame = true;
    boolean methodNameIsSame = true;
    Class<?> cl = null;/*from  w w  w. j ava2s.  c o m*/
    String methodName = null;
    for (Method method : methods) {
        if (classIsSame) {
            Class<?> declaringClass = method.getDeclaringClass();
            if (cl == null) {
                cl = declaringClass;
            } else if (!declaringClass.equals(cl)) {
                if (declaringClass.isAssignableFrom(cl)) {
                    cl = declaringClass;
                } else if (cl.isAssignableFrom(declaringClass)) {
                    // do nothing
                } else {
                    classIsSame = false;
                }
            }
        }

        if (methodNameIsSame) {
            if (methodName == null) {
                methodName = method.getName();
            } else if (!method.getName().equals(methodName)) {
                methodNameIsSame = false;
            }
        }
    }

    String className = cl.getName();
    if (!classIsSame) {
        className += "*";
    }

    if (!methodNameIsSame) {
        methodName += "*";
    }
    return new MethodInfo(className, methodName);
}

From source file:com.oscgc.security.saml.idp.web.contoller.MetadataValidator.java

public boolean supports(Class<?> clazz) {
    return clazz.equals(MetadataForm.class);
}

From source file:ca.uhn.fhir.rest.method.RawParamsParmeter.java

@Override
public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType,
        Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
    Validate.isTrue(theParameterType.equals(Map.class),
            "Parameter with @" + RawParam.class + " must be of type Map<String, List<String>>");
}

From source file:org.sakaiproject.poll.tool.validators.OptionValidator.java

public boolean supports(Class clazz) {
    // TODO Auto-generated method stub
    return clazz.equals(Option.class);
}

From source file:com.baidu.gcrm.customer.web.validator.CustomerAddValidator.java

@Override
public boolean supports(Class<?> clazz) {
    return clazz.equals(CustomerBean.class);
}

From source file:io.leishvl.core.xml.ESearchXmlBinder.java

@Override
@SuppressWarnings("unchecked")
protected <T> JAXBElement<T> createType(final T obj) {
    Object element;/*from   ww  w. ja  va2s . c  o  m*/
    Class<?> clazz = obj.getClass();
    if (clazz.equals(ESearchResult.class)) {
        element = ESEARCH_XML_FACTORY.createESearchResult();
    } else {
        throw new IllegalArgumentException("Unsupported type: " + clazz.getCanonicalName());
    }
    return (JAXBElement<T>) element;
}

From source file:com.expertiseandroid.lib.sociallib.parser.DynamicJSONParser.java

private void parseUnknown(String key, Object child, Class<? extends Object> c) throws JSONException {
    if (c.equals(JSONObject.class))
        parseJSONObject(key, (JSONObject) child);
    else if (c.equals(JSONArray.class))
        parseJSONArray(key, (JSONArray) child);
    else//from  ww w . ja v  a  2  s.  c  o m
        parseKeyValuePair(key, child);
}

From source file:edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper.java

@SuppressWarnings("rawtypes")
@Override/*from   w  ww.j  a  v  a  2s.  co  m*/
protected void finetuneMethodAppearance(Class cls, Method method, MethodAppearanceDecision decision) {

    // How to define a setter? This is a weak approximation: a method whose name
    // starts with "set" or returns void.
    if (method.getName().startsWith("set")) {
        decision.setExposeMethodAs(null);

    } else if (method.getReturnType().getName().equals("void")) {
        decision.setExposeMethodAs(null);

    } else {

        Class<?> declaringClass = method.getDeclaringClass();
        if (declaringClass.equals(java.lang.Object.class)) {
            decision.setExposeMethodAs(null);

        } else {
            Package pkg = declaringClass.getPackage();
            if (pkg.getName().equals("java.util")) {
                decision.setExposeMethodAs(null);
            }
        }
    }
}

From source file:com.seajas.search.profiler.validator.FeedValidator.java

/**
 * Determine whether this validator supports the command object.
 * /* www .  j  a  v a  2 s . c  o m*/
 * @param klass
 * @return boolean
 */
@Override
public boolean supports(final Class<?> klass) {
    return klass.equals(FeedCommand.class);
}

From source file:com.hortonworks.registries.storage.impl.jdbc.provider.oracle.statement.OracleDataTypeContext.java

protected Object getJavaObject(Class columnJavaType, String columnLabel, ResultSet resultSet)
        throws SQLException {
    if (columnJavaType.equals(String.class)) {
        String stringValue = resultSet.getString(columnLabel);
        if (stringValue != null && stringValue.equals(EMPTY_STRING_PLACEHOLDER))
            return "";
    }//from   w w w  .  j a v  a2 s. c om
    return super.getJavaObject(columnJavaType, columnLabel, resultSet);
}