Example usage for java.util Objects equals

List of usage examples for java.util Objects equals

Introduction

In this page you can find the example usage for java.util Objects equals.

Prototype

public static boolean equals(Object a, Object b) 

Source Link

Document

Returns true if the arguments are equal to each other and false otherwise.

Usage

From source file:com.connio.sdk.resource.alert.LogNotification.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    LogNotification that = (LogNotification) o;
    return Objects.equals(getLogLevel(), that.getLogLevel());
}

From source file:org.obiba.mica.core.domain.AbstractGitPersistable.java

@Override
@SuppressWarnings("SimplifiableIfStatement")
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null || getClass() != obj.getClass())
        return false;
    return Objects.equals(id, ((AbstractGitPersistable) obj).id);
}

From source file:it.ozimov.springboot.templating.mail.service.PebbleTemplateService.java

@Override
public @NonNull String mergeTemplateIntoString(final @NonNull String templateReference,
        final @NonNull Map<String, Object> model) throws IOException, TemplateException {
    checkArgument(!isNullOrEmpty(templateReference.trim()), "The given templateName is null, empty or blank");
    checkArgument(Objects.equals(getFileExtension(templateReference), expectedTemplateExtension()),
            "Expected a Pebble template file with extension %s, while %s was given. To check "
                    + "the default extension look at 'pebble.suffix' in your application.properties file",
            expectedTemplateExtension(), getFileExtension(templateReference));

    try {//w  w  w  .  j  a v  a  2s  . com
        final PebbleTemplate template = pebbleEngine.getTemplate(normalizeTemplateReference(templateReference));
        final Writer writer = new StringWriter();
        template.evaluate(writer, model);
        return writer.toString();
    } catch (PebbleException e) {
        throw new TemplateException(e);
    }
}

From source file:th.co.geniustree.dental.model.OrderProduct.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }//from w w w. j a v  a2 s. co m
    if (getClass() != obj.getClass()) {
        return false;
    }
    final OrderProduct other = (OrderProduct) obj;
    if (!Objects.equals(this.Id, other.Id)) {
        return false;
    }
    return true;
}

From source file:org.ow2.proactive.workflow_catalog.rest.dto.NamedMetadata.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }/*  w  ww .ja  va2  s . c  o m*/

    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    return Objects.equals(this.id, ((NamedMetadata) o).id);
}

From source file:it.ozimov.springboot.templating.mail.service.ThymeleafTemplateService.java

@Override
public @NonNull String mergeTemplateIntoString(final @NonNull String templateReference,
        final @NonNull Map<String, Object> model) throws IOException, TemplateException {
    checkArgument(!isNullOrEmpty(templateReference.trim()), "The given template is null, empty or blank");
    checkArgument(Objects.equals(getNormalizedFileExtension(templateReference), expectedTemplateExtension()),
            "Expected a Thymeleaf template file with extension %s, while %s was given. To check "
                    + "the default extension look at 'spring.thymeleaf.suffix' in your application.properties file",
            expectedTemplateExtension(), getNormalizedFileExtension(templateReference));

    final Context context = new Context();
    context.setVariables(model);//from  w  ww  . ja v  a  2 s.com
    return thymeleafEngine.process(getNameWithoutExtension(templateReference), context);
}

From source file:io.sidecar.credential.Credential.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }//from  ww  w.j a v a  2 s  .c  om
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    Credential that = (Credential) o;

    return Objects.equals(this.username, that.username) && Objects.equals(this.password, that.password);
}

From source file:com.github.lothar.security.acl.elasticsearch.domain.Customer.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof Customer)) {
        return false;
    }/*from  w w w.j a va2s .  c  om*/
    Customer customer = (Customer) obj;
    return Objects.equals(customer.id, id);
}

From source file:com.caricah.iotracah.bootstrap.security.realm.auth.IdConstruct.java

@Override
public boolean equals(Object o) {
    if (o == this) {
        return true;
    }//from w w  w  .  j ava 2  s .  co  m
    if (o instanceof IdConstruct) {
        IdConstruct sa = (IdConstruct) o;

        if (StringUtils.isEmpty(getClientId()) || StringUtils.isEmpty(sa.getClientId())) {

            return (Objects.equals(sa.getPartition(), getPartition())
                    && Objects.equals(sa.getUsername(), getUsername()));
        } else
            return (Objects.equals(sa.getClientId(), getClientId())
                    && Objects.equals(sa.getPartition(), getPartition())
                    && Objects.equals(sa.getUsername(), getUsername()));

    }
    return false;
}

From source file:mobile.service.FriendService.java

/**
 * ???//w  w  w  .java  2  s .  c o  m
 * 
 * @param messageId ??Id
 * @return
 */
public static ServiceResult acceptInvite(Long messageId) {
    models.User me = models.User.getFromSession(Context.current().session());

    Message message = Message.queryById(messageId);
    if (null == message || message.msgType != MsgType.ADD_FRIENDS
            || !Objects.equals(message.consumeOnly, me.id.toString())) {
        return ServiceResult.error("100005", "?messageId = " + messageId);
    }

    models.User senderUser = models.User.findById(NumberUtils.toLong(message.senderOnly, -1));
    if (null == senderUser) {
        LOGGER.error("invalid senderId. message.content = " + message.content);
        return ServiceResult.error("100001", "");
    }

    Boolean flag = FriendsService.addFriend(me, senderUser); // ?
    Boolean flag2 = FriendsService.addFriend(senderUser, me); // ?

    MessageService.pushMsgAgreeFriends(me, senderUser);
    MessageService.handlerMessage(messageId); // ???

    if (flag && flag2) {
        return ServiceResult.success();
    } else {
        return ServiceResult.error("287001", "??");
    }
}