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.web.mavenproject6.config.CustomAuthenticationProvider.java

@Override
public boolean supports(final Class<?> authentication) {
    return authentication.equals(UsernamePasswordAuthenticationToken.class);
}

From source file:eu.freme.broker.security.TokenAuthenticationProvider.java

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

From source file:org.sloth.validation.ObservationValidator.java

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

From source file:jetbrains.buildServer.vsoRooms.rest.impl.StringJsonConverter.java

public boolean canWrite(Class<?> aClass, MediaType mediaType) {
    return aClass.equals(String.class) && mediaType.equals(MediaType.APPLICATION_JSON);
}

From source file:org.mitre.openid.connect.client.keypublisher.ClientKeyPublisherMapping.java

@Override
protected boolean isHandler(Class<?> beanType) {
    return beanType.equals(ClientKeyPublisher.class);
}

From source file:org.sloth.validation.CategorieValidator.java

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

From source file:com.seajas.search.codex.validator.IdentityValidator.java

/**
 * Determine whether this validator supports the command object.
 * /*w w  w . ja  v  a 2  s .c o m*/
 * @param klass
 * @return boolean
 */
@Override
@SuppressWarnings("rawtypes")
public boolean supports(final Class klass) {
    return klass.equals(IdentityCommand.class);
}

From source file:com.hp.autonomy.frontend.configuration.authentication.IdolPreAuthenticatedAuthenticationProvider.java

@Override
public boolean supports(final Class<?> authentication) {
    return authentication.equals(PreAuthenticatedAuthenticationToken.class);
}

From source file:com.dotweblabs.twirl.gae.GaeMarshaller.java

/**
 * Creates a Key from a object instance, the kind is inspected in
 * the process./*from  ww  w  .j  a  v a 2  s  .co m*/
 *
 * @param parent key or null
 * @param instance String, Long/long key object
 * @return GAE {@code Key}
 */
public static Key createKeyFrom(Key parent, Object instance) {
    Key key = null;
    Object id = null;
    String kind = getKindOf(instance);
    if (instance instanceof Map) {
        id = ((Map) instance).get(GaeObjectStore.KEY_RESERVED_PROPERTY);
        if (id != null) {
            if (id instanceof Long || instance.getClass().equals(long.class)) {
                key = KeyStructure.createKey(parent, kind, (Long) id);
            } else if (id instanceof String) {
                key = KeyStructure.createKey(parent, kind, (String) id);
            } else {
                throw new RuntimeException(
                        "Unsupported " + GaeObjectStore.KEY_RESERVED_PROPERTY + ". Use String or Long type");
            }
        } else {
            // auto-generate "key" when not supplied
            key = KeyStructure.createKey(parent, kind, KeyStructure.autoLongId(kind));
        }
        return key;
    }

    AnnotationUtil.AnnotatedField ancestorField = AnnotationUtil
            .getFieldWithAnnotation(GaeObjectStore.ancestor(), instance);

    AnnotationUtil.AnnotatedField parentField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.parent(),
            instance);

    AnnotationUtil.AnnotatedField idField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.key(),
            instance);

    AnnotationUtil.AnnotatedField objectIdField = AnnotationUtil
            .getFieldWithAnnotation(GaeObjectStore.objectId(), instance);

    if (ancestorField != null) {
        Class<?> clazz = ancestorField.getFieldType();
        if (clazz.equals(Key.class)) {
            Key ancestor = (Key) ancestorField.getFieldValue();
            // TODO: No use use it seems
        } else {
            throw new RuntimeException("Only " + Key.class + " is supported to be annoated with @Ancestor");
        }
    }

    if (objectIdField != null) {
        if (parentField != null && parentField.getFieldValue() != null) {
            if (parentField.getFieldValue().getClass().equals(Key.class)) {
                parent = (Key) parentField.getFieldValue();
            }
        }
        Class<?> clazz = objectIdField.getFieldType();
        id = objectIdField.getFieldValue();
        if (clazz.equals(String.class)) {
            if (id != null) {
                key = KeyStructure.createKey(parent, kind, (String) id);
            } else {
                ObjectId annotation = (ObjectId) objectIdField.annotation();
                Key auto = KeyStructure.createKey(parent, kind, KeyStructure.autoLongId(kind));
                Long autoId = auto.getId();
                key = KeyStructure.createKey(parent, kind, autoId);
            }
        } else {
            throw new RuntimeException("Unsupported @ObjectId type " + id.getClass() + " Use String type only");
        }
    } else if (idField != null) {
        if (parentField != null && parentField.getFieldValue() != null) {
            if (parentField.getFieldValue().getClass().equals(Key.class)) {
                parent = (Key) parentField.getFieldValue();
            }
        }
        Class<?> clazz = idField.getFieldType();
        id = idField.getFieldValue();
        if (clazz.equals(String.class)) {
            if (id != null) {
                key = KeyStructure.createKey(parent, kind, (String) id);
            } else {
                Id annotation = (Id) idField.annotation();
                String prefix = annotation.prefix();
                if (prefix != null && !prefix.isEmpty()) {
                    Key auto = KeyStructure.createKey(parent, kind, KeyStructure.autoLongId(kind));
                    Long autoId = auto.getId();
                    key = KeyStructure.createKey(parent, kind, prefix + autoId);
                } else {
                    throw new AutoGenerateStringIdException();
                }
            }
        } else if (clazz.equals(Long.class)) {
            if (id != null) {
                key = KeyStructure.createKey(parent, kind, (Long) id);
            } else { // auto-generate
                key = KeyStructure.createKey(parent, kind, KeyStructure.autoLongId(kind));
            }
        } else if (clazz.equals(long.class)) {
            key = KeyStructure.createKey(parent, kind, (Long) id);
        } else {
            throw new RuntimeException("Unsupported @Id type " + id.getClass() + " Use String or Long type");
        }
    } else {
        throw new RuntimeException(
                "Object does not have id or key. Must put @Id annotation on " + instance.getClass());
    }
    return key;
}

From source file:cz.zcu.kiv.eegdatabase.logic.controller.myaccount.ChangePasswordValidator.java

public boolean supports(Class clazz) {
    return clazz.equals(ChangePasswordCommand.class);
}