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.idesupport.initializer.FloatControlRuleTemplateInitializer.java

public void initRuleTemplate(RuleTemplate ruleTemplate, InitializerContext initializerContext)
        throws Exception {
    String typeName = ruleTemplate.getType();
    if (StringUtils.isNotEmpty(typeName)) {
        Class<?> type = ClassUtils.forName(typeName);
        if (type.equals(FloatControl.class) || Modifier.isAbstract(type.getModifiers())) {
            return;
        }/* w  ww.ja  v a  2  s.  c o m*/

        boolean found = false;
        for (Class<?> _interface : type.getInterfaces()) {
            if (_interface.equals(FloatControl.class)) {
                found = true;
                break;
            }
        }
        if (!found) {
            return;
        }
    }

    RuleTemplateManager ruleTemplateManager = initializerContext.getRuleTemplateManager();
    RuleTemplate floatControlRule = ruleTemplateManager.getRuleTemplate("FloatControl");
    if (floatControlRule == null) {
        floatControlRule = new AutoRuleTemplate("FloatControl", FloatControl.class.getName());
        floatControlRule.setAbstract(true);
        ruleTemplateManager.addRuleTemplate(floatControlRule);
    }

    RuleTemplate[] parents = ruleTemplate.getParents();
    if (parents != null) {
        RuleTemplate[] oldParents = parents;
        parents = new RuleTemplate[oldParents.length + 1];
        System.arraycopy(oldParents, 0, parents, 0, oldParents.length);
        parents[oldParents.length] = floatControlRule;
    } else {
        parents = new RuleTemplate[] { floatControlRule };
    }
    ruleTemplate.setParents(parents);
}

From source file:org.obiba.onyx.magma.OnyxAdminValueSetBeanResolver.java

public Object resolve(Class<?> type, ValueSet valueSet, Variable variable) {
    if (type.equals(Interview.class)) {
        return getParticipant(valueSet).getInterview();
    }//from w ww. j  a  v  a 2s  . c o m
    if (type.equals(Participant.class)) {
        return getParticipant(valueSet);
    }
    if (type.equals(Action.class)) {
        return getParticipantService().getActions(getParticipant(valueSet));
    }
    if (type.equals(ApplicationConfiguration.class)) {
        return applicationConfigService.getApplicationConfiguration();
    }
    if (type.equals(StageInstance.class)) {
        Participant participant = getParticipant(valueSet);
        return interviewService.getStageInstances(participant.getInterview());
    }
    if (type.equals(ExportLog.class)) {
        return exportLogService.getExportLogs("Participant", valueSet.getVariableEntity().getIdentifier(), null,
                true);
    }
    return null;
}

From source file:com.sentinel.security.SentinelAuthenticationProvider.java

@Override
public boolean supports(Class<?> aClass) {
    LOG.trace("Method: supports called.");

    return aClass.equals(UsernamePasswordAuthenticationToken.class);

}

From source file:com.saysth.commons.quartz.ResourceLoaderClassLoadHelper.java

@SuppressWarnings("unchecked")
@Override/* w  w  w .j  a  va  2s.c  o m*/
public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException {
    Class<?> loadClass = loadClass(name);
    if (loadClass.equals(clazz)) {

    }
    return (Class<? extends T>) loadClass;
}

From source file:com.sdl.odata.example.datasource.PersistentDataSourceProvider.java

@Override
public boolean isSuitableFor(ODataRequestContext oDataRequestContext, String entityType)
        throws ODataDataSourceException {
    Class<?> javaType = oDataRequestContext.getEntityDataModel().getType(entityType).getJavaType();
    return javaType.equals(Person.class) || javaType.equals(City.class);
}

From source file:net.eusashead.hateoas.hal.http.converter.module.HalHttpMessageConverterModuleTest.java

@Override
public boolean canRead(Class<?> type) {
    return type.equals(Foo.class);
}

From source file:net.eusashead.hateoas.hal.http.converter.module.HalHttpMessageConverterModuleTest.java

@Override
public boolean canWrite(Class<?> type) {
    return type.equals(Foo.class);
}

From source file:com.almende.eve.agent.AgentBuilder.java

/**
 * Builds the./*w  w w  . j a v a  2s  .co m*/
 * 
 * @return the agent
 */
public Agent build() {
    if (parameters == null) {
        LOG.warning("AgentBuilder is not yet initialized!");
        return null;
    }
    final AgentConfig params = AgentConfig.decorate(parameters);
    final String className = params.getClassName();
    if (className == null) {
        LOG.warning("AgentBuilder requires configuration parameters: class");
        return null;
    }
    try {
        final Class<?> clazz = Class.forName(className, true, cl);
        if (clazz.equals(Agent.class) || ClassUtil.hasSuperClass(clazz, Agent.class)) {
            final Agent agent = (Agent) clazz.newInstance();
            agent.setConfig(parameters);
            return agent;
        } else {
            LOG.warning("The requested class doesn't extend Agent, which is required for the AgentBuilder");
        }
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Couldn't instantiate the agentclass", e);
    }
    return null;
}

From source file:edu.utah.further.security.impl.authentication.PreAuthenticatedFederatedAuthenticationProviderImpl.java

@Override
public boolean supports(final Class<? extends Object> authentication) {
    if (authentication.equals(FederatedAuthenticationToken.class)) {
        return true;
    }/*from www .  j  av  a 2s  .com*/
    return false;
}

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

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