Tabnine Logo
Class.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.equals (Showing top 17 results out of 315)

origin: com.jtransc/jtransc-rt

private static int deepHashCodeElement(Object element) {
  Class<?> cl;
  if (element == null) return 0;
  cl = element.getClass().getComponentType();
  if (cl == null) return element.hashCode();
  if (!cl.isPrimitive()) return deepHashCode((Object[]) element);
  if (cl.equals(int.class)) return hashCode((int[]) element);
  if (cl.equals(char.class)) return hashCode((char[]) element);
  if (cl.equals(boolean.class)) return hashCode((boolean[]) element);
  if (cl.equals(byte.class)) return hashCode((byte[]) element);
  if (cl.equals(long.class)) return hashCode((long[]) element);
  if (cl.equals(float.class)) return hashCode((float[]) element);
  if (cl.equals(double.class)) return hashCode((double[]) element);
  return hashCode((short[]) element);
}
origin: dragome/dragome-sdk

  private boolean isTestMethod(Method m)
  {
    org.junit.Test annotation = m.getAnnotation(org.junit.Test.class);
    return m.getParameterTypes().length == 0 && annotation != null && m.getReturnType().equals(Void.TYPE);
  }
}
origin: dragome/dragome-sdk

private boolean isSameClass()
{
  if (!(parameters[0] instanceof Object))
    return false;
  Class<? extends Object> type= parameters[0].getClass();
  if (Proxy.isProxyClass(type))
  {
    InvocationHandler invocationHandler= Proxy.getInvocationHandler(parameters[0]);
    if (invocationHandler instanceof InvocationHandlerForLambdas)
      type= ((InvocationHandlerForLambdas) invocationHandler).returnType;
    else
      return class1.isAssignableFrom(type);
  }
  return type.equals(class1);
}
origin: com.jtransc/jtransc-rt

@JTranscSync
static private boolean Arrays_equals(Class<?>[] l, Class<?>[] r) {
  if (l.length != r.length) return false;
  for (int n = 0; n < l.length; n++) {
    if (!l[n].equals(r[n])) return false;
  }
  return true;
}
origin: dragome/dragome-sdk

private Object convertResult(Class<?> type, String annotationValue) throws java.lang.ClassNotFoundException
{
  if (type.isArray())
  {
    List<Object> result= new ArrayList<>();
    Class<?> componentType= type.getComponentType();
    String[] items= annotationValue.replace("{", "").replace("}", "").split(",");
    for (String item : items)
    {
      Object convertResult= convertResult(componentType, item);
      result.add(convertResult);
    }
    return result.toArray();
  }
  else if (type.equals(Boolean.class) || type.equals(boolean.class))
    return Boolean.parseBoolean(annotationValue);
  else if (type.equals(Class.class))
    return Class.forName(annotationValue.substring(1, annotationValue.length() - 1).replace("/", "."));
  else if (type.equals(Integer.class) || type.equals(int.class))
    return Integer.parseInt(annotationValue);
  else if (type.equals(Double.class) || type.equals(double.class))
    return Double.parseDouble(annotationValue);
  else
    return annotationValue;
}
origin: dragome/dragome-sdk

public Object[] boxParameters(Object[] args)
{
  Class<?>[] parameterTypes= getParameterTypes();
  for (int i= 0; i < parameterTypes.length; i++)
  {
    if (parameterTypes[i].isPrimitive())
    {
      ScriptHelper.put("primitiveValue", args[i], null);
      String stringValue= (String) ScriptHelper.eval("primitiveValue.toString()", this);
      if (parameterTypes[i].equals(int.class))
        args[i]= new Integer(stringValue);
      else if (parameterTypes[i].equals(long.class))
        args[i]= new Long(stringValue);
      else if (parameterTypes[i].equals(float.class))
        args[i]= new Float(stringValue);
      else if (parameterTypes[i].equals(double.class))
        args[i]= new Double(stringValue);
      else if (parameterTypes[i].equals(short.class))
        args[i]= new Short(stringValue);
      else if (parameterTypes[i].equals(char.class))
        args[i]= new Character(stringValue.charAt(0));
      else if (parameterTypes[i].equals(byte.class))
        args[i]= new Byte(stringValue);
      else if (parameterTypes[i].equals(boolean.class))
        args[i]= new Boolean(stringValue);
    }
  }
  return args;
}
origin: com.jtransc/jtransc-rt

if (cl1.equals(int.class)) {
  return equals((int[]) e1, (int[]) e2);
if (cl1.equals(char.class)) {
  return equals((char[]) e1, (char[]) e2);
if (cl1.equals(boolean.class)) {
  return equals((boolean[]) e1, (boolean[]) e2);
if (cl1.equals(byte.class)) {
  return equals((byte[]) e1, (byte[]) e2);
if (cl1.equals(long.class)) {
  return equals((long[]) e1, (long[]) e2);
if (cl1.equals(float.class)) {
  return equals((float[]) e1, (float[]) e2);
if (cl1.equals(double.class)) {
  return equals((double[]) e1, (double[]) e2);
origin: dragome/dragome-sdk

/**
 * Determines if the class or interface represented by this Class object is either the same as, or is a
 * superclass or superinterface of, the class or interface represented by the specified Class parameter.
 */
public boolean isAssignableFrom(Class<?> otherClass)
{
  Class<?>[] interfaces= getInterfaces();
  if (otherClass == null)
    throw new NullPointerException();
  if (otherClass.isInterface() && Object.class.equals(this))
    return true;
  ScriptHelper.put("otherClass", otherClass, this);
  return ScriptHelper.evalBoolean("dragomeJs.isInstanceof(otherClass.$$$nativeClass___java_lang_Object, this.$$$nativeClass___java_lang_Object)", this);
}
origin: org.apidesign.bck2brwsr/emul.mini

public static Method findMethod(
  Class<?> clazz, String name, Class<?>... parameterTypes
) {
  name = name.replace("_", "_1");
  Object[] data = findMethodData(clazz, name + "__", false);
  BIG: for (int i = 0; i < data.length; i += 3) {
    String sig = ((String) data[i]).substring(name.length() + 2);
    Class<?> cls = (Class<?>) data[i + 2];
    Method tmp = INSTANCE.create(cls, name, data[i + 1], sig);
    Class<?>[] tmpParms = tmp.getParameterTypes();
    if (parameterTypes.length != tmpParms.length) {
      continue;
    }
    for (int j = 0; j < tmpParms.length; j++) {
      if (!parameterTypes[j].equals(tmpParms[j])) {
        continue BIG;
      }
    }
    return tmp;
  }
  return null;
}

origin: org.apidesign.bck2brwsr/emul.mini

public static Constructor findConstructor(
  Class<?> clazz, Class<?>... parameterTypes) {
  Object[] data = findMethodData(clazz, "cons__", true);
  BIG: for (int i = 0; i < data.length; i += 3) {
    String sig = ((String) data[i]).substring(6);
    Class<?> cls = (Class<?>) data[i + 2];
    Constructor tmp = INSTANCE.create(cls, data[i + 1], sig);
    Class<?>[] tmpParms = tmp.getParameterTypes();
    if (parameterTypes.length != tmpParms.length) {
      continue;
    }
    for (int j = 0; j < tmpParms.length; j++) {
      if (!parameterTypes[j].equals(tmpParms[j])) {
        continue BIG;
      }
    }
    return tmp;
  }
  return null;
}
origin: dragome/dragome-sdk

if (currentReturnType.equals(Boolean.class))
  result= result instanceof Boolean ? result : (ScriptHelper.evalBoolean("result", null) ? Boolean.TRUE : Boolean.FALSE);
else if (currentReturnType.equals(Integer.class))
  result= Integer.parseInt(ScriptHelper.evalInt("result", null) + "");
else if (currentReturnType.equals(Long.class))
  result= Long.parseLong(ScriptHelper.evalInt("result", null) + "");
else if (currentReturnType.equals(Short.class))
  result= Short.parseShort(ScriptHelper.evalInt("result", null) + "");
else if (currentReturnType.equals(Float.class))
  result= Float.parseFloat(ScriptHelper.evalFloat("result", null) + "");
else if (currentReturnType.equals(Double.class))
  result= Double.parseDouble(ScriptHelper.evalDouble("result", null) + "");
else if (currentReturnType.equals(Byte.class))
  result= Byte.valueOf((byte) ScriptHelper.evalChar("result", null));
else if (currentReturnType.equals(Character.class))
  result= Character.valueOf((ScriptHelper.eval("result", null) + "").charAt(0));
origin: jtulach/bck2brwsr

public static Method findMethod(
  Class<?> clazz, String name, Class<?>... parameterTypes
) {
  name = name.replace("_", "_1");
  Object[] data = findMethodData(clazz, name + "__", false);
  BIG: for (int i = 0; i < data.length; i += 3) {
    String sig = ((String) data[i]).substring(name.length() + 2);
    Class<?> cls = (Class<?>) data[i + 2];
    Method tmp = INSTANCE.create(cls, name, data[i + 1], sig);
    Class<?>[] tmpParms = tmp.getParameterTypes();
    if (parameterTypes.length != tmpParms.length) {
      continue;
    }
    for (int j = 0; j < tmpParms.length; j++) {
      if (!parameterTypes[j].equals(tmpParms[j])) {
        continue BIG;
      }
    }
    return tmp;
  }
  return null;
}

origin: jtulach/bck2brwsr

public static Constructor findConstructor(
  Class<?> clazz, Class<?>... parameterTypes) {
  Object[] data = findMethodData(clazz, "cons__", true);
  BIG: for (int i = 0; i < data.length; i += 3) {
    String sig = ((String) data[i]).substring(6);
    Class<?> cls = (Class<?>) data[i + 2];
    Constructor tmp = INSTANCE.create(cls, data[i + 1], sig);
    Class<?>[] tmpParms = tmp.getParameterTypes();
    if (parameterTypes.length != tmpParms.length) {
      continue;
    }
    for (int j = 0; j < tmpParms.length; j++) {
      if (!parameterTypes[j].equals(tmpParms[j])) {
        continue BIG;
      }
    }
    return tmp;
  }
  return null;
}
origin: com.jtransc/jtransc-rt

if (elemElemClass.isPrimitive()) {
  if (boolean.class.equals(elemElemClass)) {
    sb.append(toString((boolean[]) elem));
  } else if (byte.class.equals(elemElemClass)) {
    sb.append(toString((byte[]) elem));
  } else if (char.class.equals(elemElemClass)) {
    sb.append(toString((char[]) elem));
  } else if (double.class.equals(elemElemClass)) {
    sb.append(toString((double[]) elem));
  } else if (float.class.equals(elemElemClass)) {
    sb.append(toString((float[]) elem));
  } else if (int.class.equals(elemElemClass)) {
    sb.append(toString((int[]) elem));
  } else if (long.class.equals(elemElemClass)) {
    sb.append(toString((long[]) elem));
  } else if (short.class.equals(elemElemClass)) {
    sb.append(toString((short[]) elem));
  } else {
origin: dragome/dragome-sdk

if (type.equals(Integer.class))
  return ScriptHelper.eval("intValue", null);
else if (type.equals(Boolean.class))
  return ScriptHelper.eval("booleanValue", null);
else if (type.equals(Long.class))
  return ScriptHelper.eval("longValue", null);
else if (type.equals(Short.class))
  return ScriptHelper.eval("shortValue", null);
else if (type.equals(Byte.class))
  return ScriptHelper.eval("byteValue", null);
else if (type.equals(Float.class))
  return ScriptHelper.eval("floatValue", null);
else if (type.equals(Double.class))
else if (type.equals(Character.class))
origin: dragome/dragome-sdk

public static <A extends Annotation> A getAnnotationInternal(Class<?> aClass, Class<A> annotationClass, String methodName, Integer parameterIndex, String fieldName)
{
  List<AnnotationEntry> annotationEntries= new ArrayList<>(AnnotationsHelper.getAnnotationsByType(annotationClass).getEntries());
  boolean annotationFound= false;
  for (AnnotationEntry annotationEntry : annotationEntries)
    if (annotationEntry.getType().equals(aClass))
    {
      String annotationKey= AnnotationInvocationHandler.getAnnotationKey(fieldName, parameterIndex, methodName, "");
      if (annotationEntry.getAnnotationKey().startsWith(annotationKey) || (annotationKey == null && !annotationEntry.getAnnotationKey().contains("/")))
        annotationFound= true;
    }
  if (!annotationFound)
    return null;
  A annotation= (A) Proxy.newProxyInstance(null, new Class[] { annotationClass }, new AnnotationInvocationHandler(aClass, annotationClass, methodName, parameterIndex, fieldName));
  return annotation;
}
origin: dragome/dragome-sdk

public Object invoke(Object proxy, Method method, Object[] args) throws java.lang.ClassNotFoundException
{
  ScriptHelper.put("method", method, this);
  String name= method.getName();
  if (name.equals("toString"))
  {
    return clazz.toString();
  }
  else if (name.equals("annotationType"))
  {
    return annotationClass;
  }
  else
  {
    List<AnnotationEntry> annotationEntries= new ArrayList<>(AnnotationsHelper.getAnnotationsByType(annotationClass).getEntries());
    for (AnnotationEntry annotationEntry : annotationEntries)
    {
      String key= getAnnotationKey(fieldName, parameterIndex, methodName, name);
      if (annotationEntry.getType().equals(clazz) && annotationEntry.getAnnotationKey().startsWith(key))
      {
        java.lang.String annotationValue= annotationEntry.getAnnotationValue();
        return convertResult(method.getReturnType(), annotationValue);
      }
    }
    String result= (String) ScriptHelper.eval("this.$$$annotationClass___java_lang_Class.$$$nativeClass___java_lang_Object.$$members[method.$$$signature___java_lang_String].apply()", this);
    return convertResult(method.getReturnType(), result);
  }
}
java.langClassequals

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
    Finds a resource with a given name. The rules for searching resources associated with a given class
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Collectors (java.util.stream)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now