List of usage examples for java.util Objects equals
public static boolean equals(Object a, Object b)
From source file:ch.algotrader.cache.EntityCacheSubKey.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null) { return false; } else if (!(obj instanceof EntityCacheSubKey)) { return false; } else {/*from w ww. jav a 2s . c o m*/ EntityCacheSubKey that = (EntityCacheSubKey) obj; return super.equals(that) && Objects.equals(this.key, that.key); } }
From source file:com.cognifide.aet.job.api.collector.JsErrorLog.java
@Override public boolean equals(Object obj) { boolean result = false; if (obj == this) { result = true;// www. ja v a2 s . c o m } else if (obj != null && obj.getClass() == this.getClass()) { JsErrorLog other = (JsErrorLog) obj; result = Objects.equals(errorMessage, other.errorMessage) && Objects.equals(sourceName, other.sourceName) && Objects.equals(lineNumber, other.lineNumber); } return result; }
From source file:com.onyxscheduler.domain.JobKey.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/* ww w .ja v a2 s .c o m*/ if (obj == null || getClass() != obj.getClass()) { return false; } final JobKey other = (JobKey) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.group, other.group); }
From source file:it.ozimov.springboot.templating.mail.service.MustacheTemplateService.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 Mustache template file with extension %s, while %s was given. To check " + "the default extension look at 'spring.mustache.suffix' in your application.properties file", expectedTemplateExtension(), getFileExtension(templateReference)); try {/*w w w . j a va 2 s .com*/ final Reader template = mustacheAutoConfiguration.mustacheTemplateLoader() .getTemplate(normalizeTemplateReference(templateReference)); return mustacheAutoConfiguration.mustacheCompiler(mustacheAutoConfiguration.mustacheTemplateLoader()) .compile(template).execute(model); } catch (Throwable t) { throw new TemplateException(t); } }
From source file:com.example.app.resource.model.ResourceTypeUserType.java
@Override public boolean equals(Object x, Object y) throws HibernateException { if (Objects.equals(x, y)) return true; if ((x == null) || (y == null)) return false; ResourceType resourceType1 = (ResourceType) x; ResourceType resourceType2 = (ResourceType) y; final ResourceTypeService.Context context = new ResourceTypeService.Context( _siteContext.getOperationalSite()); String factory1 = _resourceTypeService.getFactoryIdentifier(context, resourceType1); if (factory1 == null) throw new HibernateException("Invalid ResourceType: " + x); String factory2 = _resourceTypeService.getFactoryIdentifier(context, resourceType2); if (factory2 == null) throw new HibernateException("Invalid ResourceType: " + y); return factory1.equals(factory2) && resourceType1.getIdentifier().equals(resourceType2.getIdentifier()); }
From source file:com.connio.sdk.auth.ApiKeyContext.java
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ApiKeyContext that = (ApiKeyContext) o; return Objects.equals(type, that.type) && Objects.equals(ids, that.ids); }
From source file:com.vsct.dt.hesperides.applications.PlatformSnapshotRestoreEvent.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/*from w w w .j av a2s . c o m*/ if (obj == null || getClass() != obj.getClass()) { return false; } final PlatformSnapshotRestoreEvent other = (PlatformSnapshotRestoreEvent) obj; return Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.snapshot, other.snapshot); }
From source file:technology.tikal.customers.model.name.NombrePersonaSimpleMx.java
@Override public boolean equals(Object obj) { if (obj == this) { return true; }// w w w. ja va 2 s.c om if (obj instanceof NombrePersonaSimpleMx) { NombrePersonaSimpleMx other = (NombrePersonaSimpleMx) obj; return Objects.equals(nombres, other.nombres) && Objects.equals(apellidos, other.apellidos); } return false; }
From source file:com.liferay.blade.cli.util.Prompter.java
private static Optional<Boolean> _getBooleanAnswer(String questionWithPrompt, InputStream inputStream, PrintStream printStream, Optional<Boolean> defaultAnswer) { Optional<Boolean> answer = null; try (CloseShieldInputStream closeShieldInputStream = new CloseShieldInputStream(inputStream); Scanner scanner = new Scanner(closeShieldInputStream)) { while ((answer == null) || !answer.isPresent()) { printStream.println(questionWithPrompt); String readLine = null; while (((answer == null) || !answer.isPresent()) && !Objects.equals(answer, defaultAnswer) && scanner.hasNextLine()) { readLine = scanner.nextLine(); if (readLine != null) { readLine = readLine.toLowerCase(); switch (readLine.trim()) { case "y": case "yes": answer = Optional.of(true); break; case "n": case "no": answer = Optional.of(false); break; default: if (defaultAnswer.isPresent()) { answer = defaultAnswer; } else { printStream.println("Unrecognized input: " + readLine); continue; }/* ww w . java 2 s. c om*/ break; } } else { answer = defaultAnswer; } } } } catch (IllegalStateException ise) { throw new RuntimeException(ise); } catch (Exception exception) { if (defaultAnswer.isPresent()) { answer = defaultAnswer; } } return answer; }
From source file:org.trustedanalytics.user.invite.config.SmtpProperties.java
@Override public boolean equals(Object obj) { if (obj == this) { return true; }/*from w w w .ja v a 2 s .com*/ SmtpProperties other; if (obj instanceof SmtpProperties) { other = (SmtpProperties) obj; return allTrue(Objects.equals(timeout, other.timeout), Objects.equals(debug, other.debug), Objects.equals(host, other.host), Objects.equals(emailName, other.emailName), Objects.equals(protocol, other.protocol), Objects.equals(username, other.username), Objects.equals(password, other.password), Objects.equals(port, other.port)); } return false; }