List of usage examples for java.util Arrays equals
public static boolean equals(Object[] a, Object[] a2)
From source file:grails.plugin.springsecurity.acl.util.ProxyUtils.java
/** * Finds the constructor in the unproxied superclass if proxied. * @param constructor the constructor//from www. jav a 2 s . c o m * @return the constructor in the unproxied class */ public static Constructor<?> unproxy(final Constructor<?> constructor) { Class<?> clazz = constructor.getDeclaringClass(); if (!isProxy(clazz)) { return constructor; } Class<?> searchType = unproxy(clazz); while (searchType != null) { for (Constructor<?> c : searchType.getConstructors()) { if (constructor.getName().equals(c.getName()) && (constructor.getParameterTypes() == null || Arrays.equals(constructor.getParameterTypes(), c.getParameterTypes()))) { return c; } } searchType = searchType.getSuperclass(); } return null; }
From source file:ch.rgw.tools.PasswordEncryptionService.java
public boolean authenticate(String attemptedPassword, byte[] encryptedPassword, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException { // Encrypt the clear-text password using the same salt that was used to // encrypt the original password byte[] encryptedAttemptedPassword = getEncryptedPassword(attemptedPassword, salt); // Authentication succeeds if encrypted password that the user entered // is equal to the stored hash return Arrays.equals(encryptedPassword, encryptedAttemptedPassword); }
From source file:com.cloudera.crunch.TupleN.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TupleN other = (TupleN) obj;/* w w w.j av a 2s . c o m*/ return Arrays.equals(this.values, other.values); }
From source file:org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285CostType.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj != null ? (obj instanceof RFC7285CostType) : false)) return false; RFC7285CostType other = (RFC7285CostType) obj; String[] lhs = { metric, mode }; String[] rhs = { other.metric, other.mode }; return Arrays.equals(lhs, rhs); }
From source file:com.opengamma.financial.analytics.forwardcurve.ForwardCurveDefinition.java
@Override public boolean equals(final Object obj) { if (obj == null) { return false; }//from w w w .java 2 s .com if (!(obj instanceof ForwardCurveDefinition)) { return false; } final ForwardCurveDefinition other = (ForwardCurveDefinition) obj; return getTarget().equals(other.getTarget()) && getName().equals(other.getName()) && Arrays.equals(getTenors(), other.getTenors()); }
From source file:ru.mystamps.web.validation.jsr303.ImageFileValidator.java
private static boolean isItReallyPng(byte[] bytes) { return Arrays.equals(bytes, PNG_SECOND_PART_SIGNATURE); }
From source file:MultiKey.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final MultiKey other = (MultiKey) obj; return Arrays.equals(values, other.values); }
From source file:dk.statsbiblioteket.doms.surveillance.surveyor.SurveyorServletUtils.java
/** * Handle actions given a servlet request on a surveyor. * Will handle requests to mark a log message as handled, and requests * never to show a given message again./*ww w. j a v a 2 s.c o m*/ * @param request The request containing the parameters. * @param surveyor The surveyor to call the actions on. */ public static void handlePostedParameters(HttpServletRequest request, Surveyor surveyor) { log.trace("Enter handlePostedParameters()"); String applicationName; try { request.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { //UTF-8 must be supported as per spec. throw new Error("UTF-8 unsupported by JVM", e); } applicationName = request.getParameter("applicationname"); if (applicationName != null) { Map<String, String[]> parameters = request.getParameterMap(); for (String key : parameters.keySet()) { if (key.startsWith("handle:") && Arrays.equals(new String[] { "Handled" }, parameters.get(key))) { surveyor.markHandled(applicationName, key.substring("handle:".length())); } } if (request.getParameter("notagain") != null) { surveyor.notAgain(applicationName, request.getParameter("notagain")); } } }
From source file:ReflectionUtils.java
/** * Attempt to find a {@link Method} on the supplied class with the supplied name * and parameter types. Searches all superclasses up to <code>Object</code>. * <p>Returns <code>null</code> if no {@link Method} can be found. * @param clazz the class to introspect/*w ww .ja v a2s . c o m*/ * @param name the name of the method * @param paramTypes the parameter types of the method * @return the Method object, or <code>null</code> if none found */ public static Method findMethod(Class clazz, String name, Class[] paramTypes) { Class searchType = clazz; while (!Object.class.equals(searchType) && searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (name.equals(method.getName()) && Arrays.equals(paramTypes, method.getParameterTypes())) { return method; } } searchType = searchType.getSuperclass(); } return null; }
From source file:org.codehaus.groovy.grails.plugins.springsecurity.acl.ProxyUtils.java
/** * Finds the constructor in the unproxied superclass if proxied. * @param constructor the constructor//from w ww .ja v a 2 s . c om * @return the constructor in the unproxied class */ public static Constructor<?> unproxy(final Constructor<?> constructor) { Class<?> clazz = constructor.getDeclaringClass(); if (!AopUtils.isCglibProxyClass(clazz)) { return constructor; } Class<?> searchType = unproxy(clazz); while (searchType != null) { for (Constructor<?> c : searchType.getConstructors()) { if (constructor.getName().equals(c.getName()) && (constructor.getParameterTypes() == null || Arrays.equals(constructor.getParameterTypes(), c.getParameterTypes()))) { return c; } } searchType = searchType.getSuperclass(); } return null; }