List of usage examples for java.lang Object equals
public boolean equals(Object obj)
From source file:com.example.EditingWindow.java
protected FormLayout makeFormLayout(BeanFieldGroup<Person> fieldGroup, BeanItem<Person> item) { FormLayout formLayout = new FormLayout(); formLayout.setMargin(true);/* www. j a va 2 s . c om*/ formLayout.setHeightUndefined(); fieldGroup.setItemDataSource(person); for (Object pid : item.getItemPropertyIds()) { if (pid.equals("id")) continue; formLayout.addComponent(fieldGroup.buildAndBind(pid)); } return formLayout; }
From source file:com.worldline.easycukes.commons.helpers.JSONHelper.java
/** * Returns <b>true</b> if JSON object o1 is equals to JSON object o2. * * @param o1 a {@link JSONObject} containing some JSON data * @param o2 another {@link JSONObject} containing some JSON data * @return true if the json objects are equals *///ww w . jav a 2 s .c o m public static boolean equals(@NonNull JSONObject o1, @NonNull JSONObject o2) { if (o1 == o2) return true; if (o1.size() != o2.size()) return false; try { final Iterator<Entry<String, Object>> i = o1.entrySet().iterator(); while (i.hasNext()) { final Entry<String, Object> e = i.next(); final String key = e.getKey(); final Object value1 = e.getValue(); final Object value2 = o2.get(key); if (value1 == null) { if (!(o2.get(key) == null && o2.containsKey(key))) return false; } else if (value1 instanceof JSONObject) { if (!(value2 instanceof JSONObject)) return false; if (!equals((JSONObject) value1, (JSONObject) value2)) return false; } else if (value1 instanceof JSONArray) { if (!(value2 instanceof JSONArray)) return false; if (!equals((JSONArray) value1, (JSONArray) value2)) return false; } else if (!value1.equals(value2)) return false; } } catch (final Exception unused) { unused.printStackTrace(); return false; } return true; }
From source file:com.revolsys.ui.web.config.JexlHttpServletRequestContext.java
@Override public Map getVars() { return new AbstractMap() { @Override//from w ww . jav a 2 s .c o m public Set entrySet() { final Map map = new HashMap(); map.putAll(JexlHttpServletRequestContext.this.request.getParameterMap()); for (final Enumeration names = JexlHttpServletRequestContext.this.request.getAttributeNames(); names .hasMoreElements();) { final String name = (String) names.nextElement(); map.put(name, JexlHttpServletRequestContext.this.request.getAttribute(name)); } if (JexlHttpServletRequestContext.this.servletContext != null) { for (final Enumeration names = JexlHttpServletRequestContext.this.servletContext .getAttributeNames(); names.hasMoreElements();) { final String name = (String) names.nextElement(); map.put(name, JexlHttpServletRequestContext.this.servletContext.getAttribute(name)); } } return map.entrySet(); } @Override public Object get(final Object key) { if (key.equals("request")) { return JexlHttpServletRequestContext.this.request; } else if (key.equals("requestURI")) { return JexlHttpServletRequestContext.this.urlPathHelper .getOriginatingRequestUri(JexlHttpServletRequestContext.this.request); } final String keyString = key.toString(); Object value = null; if (JexlHttpServletRequestContext.this.servletContext != null) { value = JexlHttpServletRequestContext.this.servletContext.getAttribute(keyString); } if (value == null) { value = JexlHttpServletRequestContext.this.request.getAttribute(keyString); if (value == null) { value = JexlHttpServletRequestContext.this.request.getParameter(keyString); } } if (value == null) { return ""; } else { return value; } } }; }
From source file:it.unibas.spicygui.controllo.mapping.ActionExportTgds.java
public void update(Observable o, Object stato) { if (stato.equals(LastActionBean.SOLVE) || stato.equals(LastActionBean.SOLVE_AND_TRANSLATE)) { this.setEnabled(true); } else {// ww w. ja v a2 s . c o m this.setEnabled(false); } }
From source file:com.lonepulse.zombielink.request.HeaderProcessor.java
private void addHeader(HttpRequestBase request, String name, Object value) { if (value != null && !value.equals("")) { if (!(value instanceof CharSequence)) { StringBuilder errorContext = new StringBuilder().append("Header values can only be of type ") .append(CharSequence.class.getName()) .append(". Please consider using an implementation of CharSequence for the header <") .append(name)// w w w .j av a2 s. com .append("> and providing a meaningful toString() implementation for the header-value. ") .append("Furthermore, response headers should be of the specialized type ") .append(StringBuilder.class.getName()); throw new IllegalArgumentException(errorContext.toString()); } request.addHeader(name, value.toString()); } }
From source file:com.scf.core.ebus.GuavaEventBusTest.java
@Test public void testEvent() { EventBusRepository.regGlobalBus(false); EventListener el = new EventListener(); EventBusRepository.getGlobalBus().addEventListener(el); Object e = "abc"; EventBusRepository.getGlobalBus().dispatchEvent(e); Assert.assertTrue(e.equals(el.testEvent)); EventBusRepository.getGlobalBus().dispatchEvent(123); EventBusRepository.unRegGlobalBus(); }
From source file:jp.sourceforge.tmdmaker.ui.views.properties.DiagramPropertySource.java
@Override public boolean isPropertySet(Object id) { if (id.equals(NAME) || id.equals(DATABASE_NAME) || id.equals(DESCRIPTION)) { return true; }/*from w ww . j a va2s . c o m*/ return false; }
From source file:com.chortitzer.web.fps.controller.LotesBean.java
public void onCellEdit(CellEditEvent event) { Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); if (newValue != null && !newValue.equals(oldValue)) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cell Changed", "Old: " + oldValue + ", New:" + newValue); FacesContext.getCurrentInstance().addMessage(null, msg); //dt = (TblFpsLotesList)event.getSource(); dao.save(tblFpsLotesList.get(event.getRowIndex())); if (tblFpsLotesList.get(event.getRowIndex()).getId() == null) { tblFpsLotesList = dao.getAll(TblFpsLotes.class); }/* ww w. j ava 2 s.c o m*/ System.out.println(tblFpsLotesList.get(event.getRowIndex()).getId()); } }
From source file:com.feedzai.fos.api.Attribute.java
/** * Parses the provided value for the current Attribute configuration. * * @param original The original value of the field. * @return The value in the correct representation for the classifier or missing value. *//* w ww .j a v a 2s. co m*/ public double parseOrMissing(@NotNull Object original) { try { if (original.equals(MISSING_VALUE_STR)) { return MISSING_VALUE; } return this.parse(original); } catch (FOSException e) { logger.warn("Failed to parse {} using missing value instead", original); return MISSING_VALUE; } }
From source file:com.puppycrawl.tools.checkstyle.internal.XdocsPagesTest.java
private static String getModulePropertyExpectedValue(Class<?> clss, Object instance, String propertyName) throws Exception { final Field field = getField(instance.getClass(), propertyName); String result = null;//w w w. j a v a2s . c o m if (field != null) { final Object value = field.get(instance); if (clss == boolean.class) { result = value.toString(); } else if (clss == int.class) { if (value.equals(Integer.MAX_VALUE)) { result = "java.lang.Integer.MAX_VALUE"; } else { result = value.toString(); } } else if (clss == int[].class) { result = Arrays.toString((int[]) value).replace("[", "").replace("]", ""); if (result.isEmpty()) { result = "{}"; } } else if (clss == double[].class) { result = Arrays.toString((double[]) value).replace("[", "").replace("]", "").replace(".0", ""); if (result.isEmpty()) { result = "{}"; } } else if (clss == URI.class) { if (value != null) { result = '"' + value.toString() + '"'; } } else if (clss == Pattern.class) { if (value != null) { result = '"' + value.toString().replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r") .replace("\f", "\\f") + '"'; } if ("\"$^\"".equals(result)) { result += " (empty)"; } } else if (value != null && (clss == SeverityLevel.class || clss == Scope.class)) { result = value.toString().toLowerCase(Locale.ENGLISH); } else if (value != null && clss == AccessModifier[].class) { result = Arrays.toString((Object[]) value).replace("[", "").replace("]", ""); } if (clss != String.class && clss != String[].class && result == null) { result = "null"; } } return result; }