List of usage examples for java.lang Object equals
public boolean equals(Object obj)
From source file:org.springframework.cloud.contract.stubrunner.messaging.camel.StubRunnerCamelPredicate.java
private boolean headersMatch(Exchange exchange) { Map<String, Object> headers = exchange.getIn().getHeaders(); boolean matches = true; for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) { String name = it.getName(); Object value = it.getClientValue(); Object valueInHeader = headers.get(name); matches &= value instanceof Pattern ? ((Pattern) value).matcher(valueInHeader.toString()).matches() : valueInHeader != null && valueInHeader.equals(value); }/* w w w. j av a2s. c o m*/ return matches; }
From source file:org.springframework.cloud.contract.stubrunner.messaging.integration.StubRunnerIntegrationMessageSelector.java
private boolean headersMatch(Message<?> message) { Map<String, Object> headers = message.getHeaders(); boolean matches = true; for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) { String name = it.getName(); Object value = it.getClientValue(); Object valueInHeader = headers.get(name); matches &= value instanceof Pattern ? ((Pattern) value).matcher(valueInHeader.toString()).matches() : valueInHeader != null && valueInHeader.equals(value); }//w w w. j av a2s. c om return matches; }
From source file:cz.clovekvtisni.coordinator.server.validation.constraints.impl.EqualPropertiesValidator.java
@Override public boolean isValid(Object bean, ConstraintValidatorContext context) { Object prevValue = null;//w w w . j a v a 2 s . c o m BeanWrapper beanWrapper = new BeanWrapperImpl(bean); for (int i = 0, l = annotation.properties().length; i < l; i++) { Object value = beanWrapper.getPropertyValue(annotation.properties()[i]); if (i == 0) { prevValue = value; } else { if (value == null && prevValue != null || value != null && !value.equals(prevValue)) { context.buildConstraintViolationWithTemplate(annotation.message()) .addNode(annotation.properties()[0]).addConstraintViolation() .disableDefaultConstraintViolation(); return false; } } } return true; }
From source file:org.codehaus.groovy.grails.plugins.searchable.compass.config.mapping.SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.java
/** * Returns the collection of GrailsDomainClasses that are mapped by this instance * @param grailsDomainClasses ALL domain classes * @return the collection of domain classes mapped by this instance *///from ww w. ja va 2 s .c o m public Collection getMappedBy(Collection grailsDomainClasses) { Set mappedBy = new HashSet(); for (Iterator iter = grailsDomainClasses.iterator(); iter.hasNext();) { GrailsDomainClass grailsDomainClass = (GrailsDomainClass) iter.next(); Object value = SearchableUtils.getSearchablePropertyValue(grailsDomainClass); if (value != null) { if (!((value instanceof Boolean) && value.equals(Boolean.FALSE))) { mappedBy.add(grailsDomainClass); } continue; } if (SearchableUtils.isEmbeddedPropertyOfOtherDomainClass(grailsDomainClass, grailsDomainClasses)) { mappedBy.add(grailsDomainClass); } } return mappedBy; }
From source file:com.vetstreet.embedded.jirb.SshServerFactory.java
public void afterPropertiesSet() throws Exception { SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(port);// www . j a va 2 s.c o m sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser")); Factory<Command> factory = null; // factory = new ProcessShellFactory(new String[] { "/bin/bash", "-i", "irb" }, EnumSet.of(ProcessShellFactory.TtyOptions.ONlCr)); factory = new ShellFactoryImpl(this);//ShellFactoryImpl(); sshd.setShellFactory(factory); final Properties userprops = new Properties(); if (userpasses != null) { userprops.load(userpasses.getInputStream()); } PasswordAuthenticator authenticator = null; if (configurationMap == null) { authenticator = new PasswordAuthenticator() { public boolean authenticate(String arg0, String arg1, ServerSession arg2) { Object response = userprops.get(arg0); if (response != null) return response.equals(arg1); else if (arg0.equals("jirb") && arg1.equals("jruby15awesom3")) return true; else return false; } }; } else { SecurityContextManager manager = new SecurityContextManager(context, configurationMap); authenticator = manager.getPasswordAuthenticator(); } if (authenticator == null) throw new Exception("Null authenticator! Configuration issue."); sshd.setPasswordAuthenticator(authenticator); this.server = sshd; this.start(); }
From source file:com.linkedin.pinot.core.segment.creator.impl.stats.AbstractColumnStatisticsCollector.java
void addressSorted(Object entry) { if (isSorted) { if (previousValue != null) { if (!entry.equals(previousValue) && previousValue != null) { final Comparable prevValue = (Comparable) previousValue; final Comparable origin = (Comparable) entry; if (origin.compareTo(prevValue) < 0) { isSorted = false;/* w ww . ja va2 s . com*/ } } } previousValue = entry; } }
From source file:com.microsoft.alm.plugin.idea.tfvc.ui.workspace.WorkspaceController.java
@Override public void update(final Observable o, final Object arg) { if (suspendEvents) { return;// w w w .jav a 2 s . c o m } if (arg == null || arg.equals(WorkspaceModel.PROP_COMMENT)) { dialog.setComment(model.getComment()); } if (arg == null || arg.equals(WorkspaceModel.PROP_COMPUTER)) { dialog.setComputer(model.getComputer()); } if (arg == null || arg.equals(WorkspaceModel.PROP_MAPPINGS)) { dialog.setMappings(model.getMappings()); } if (arg == null || arg.equals(WorkspaceModel.PROP_NAME)) { dialog.setName(model.getName()); } if (arg == null || arg.equals(WorkspaceModel.PROP_OWNER)) { dialog.setOwner(model.getOwner()); } if (arg == null || arg.equals(WorkspaceModel.PROP_SERVER)) { dialog.setServer(model.getServer()); } // Loading is special we only want to update it when it is the only thing changing if (arg != null && arg.equals(WorkspaceModel.PROP_LOADING)) { dialog.setLoading(model.isLoading()); } }
From source file:com.autentia.wuija.security.impl.hibernate.HibernateGrantedAuthority.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }//www. ja v a 2 s . co m if (obj == null) { return false; } if (obj instanceof String) { return obj.equals(this.role); } try { final GrantedAuthority other = (GrantedAuthority) obj; return this.role.equals(other.getAuthority()); } catch (Exception e) { return false; } }
From source file:MicroMap.java
/** * @see java.util.Map#remove(java.lang.Object) *///from ww w . j av a2s .co m public Object remove(final Object key) { if (key.equals(this.key)) { final Object oldValue = this.value; this.key = null; this.value = null; return oldValue; } return null; }