Finds and returns a MethodHandle for the default constructor of the given class, {@code clazz}.

@param clazz
the class
@return a MethodHandle for the default constructor. Returns {@code null} if the class does not
have a public no-argument constructor.
480171
public static MethodHandle findDefaultConstructor(Class<?> clazz) {
    MethodHandle methodHandle = null;
    try {
      Constructor<?> constructor = clazz.getConstructor();
      methodHandle = MethodHandles.publicLookup().unreflectConstructor(constructor);
    } catch (NoSuchMethodException | SecurityException | IllegalAccessException e) {
      // No default constructor
    }
    return methodHandle;
  }
1130800
public static Logger getLogger(Class<?> clazz) {
    if (hasToLog != null && hasToLog) {
      return new Slf4JLogger(org.slf4j.LoggerFactory.getLogger(clazz));
    } else {
      return NO_LOGGER;
    }
  }
964873
public static boolean hasAccessibleDefaultConstructor(Class<?> clazz) {
    Constructor<?> constructor;
    try {
      constructor = clazz.getDeclaredConstructor();
    } catch (NoSuchMethodException e) {
      return clazz.getDeclaredConstructors().length == 0;
    }

    return !isPrivate(constructor);
  }
1169280
public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> clazz) {
        return getExtensionLoader(clazz, null);
    }
263974
public static Constructor<?> getConstructor(final Class<?> clazz,
        final Class<?>... argumentTypes) throws NoSuchMethodException {
        try {
            return AccessController
                .doPrivileged(new PrivilegedExceptionAction<Constructor<?>>() {
                    public Constructor<?> run()
                        throws NoSuchMethodException {
                        return clazz.getConstructor(argumentTypes);
                    }
                });
        }
        // Unwrap
        catch (final PrivilegedActionException pae) {
            final Throwable t = pae.getCause();
            // Rethrow
            if (t instanceof NoSuchMethodException) {
                throw (NoSuchMethodException) t;
            } else {
                // No other checked Exception thrown by Class.getConstructor
                try {
                    throw (RuntimeException) t;
                }
                // Just in case we've really messed up
                catch (final ClassCastException cce) {
                    throw new RuntimeException(
                        "Obtained unchecked Exception; this code should never be reached",
                        t);
                }
            }
        }
    }
91526
private void visitClass(final Class clazz) {
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            Class<?>[] exceptionTypes = method.getExceptionTypes();
            String[] exceptions = new String[exceptionTypes.length];
            for (int i = 0; i < exceptions.length; i++) {
                exceptions[i] = BytecodeHelper.getClassInternalName(exceptionTypes[i]);
            }
            // for each method defined in the class, generate the appropriate delegation bytecode
            visitMethod(method.getModifiers(),
                    method.getName(),
                    BytecodeHelper.getMethodDescriptor(method.getReturnType(), method.getParameterTypes()),
                    null,
                    exceptions);
        }
        Constructor[] constructors = clazz.getDeclaredConstructors();
        for (Constructor method : constructors) {
            Class<?>[] exceptionTypes = method.getExceptionTypes();
            String[] exceptions = new String[exceptionTypes.length];
            for (int i = 0; i < exceptions.length; i++) {
                exceptions[i] = BytecodeHelper.getClassInternalName(exceptionTypes[i]);
            }
            // for each method defined in the class, generate the appropriate delegation bytecode
            visitMethod(method.getModifiers(),
                    "<init>",
                    BytecodeHelper.getMethodDescriptor(Void.TYPE, method.getParameterTypes()),
                    null,
                    exceptions);
        }

        for (Class intf : clazz.getInterfaces()) {
            visitClass(intf);
        }
        Class superclass = clazz.getSuperclass();
        if (superclass != null) visitClass(superclass);

        // Ultimately, methods can be available in the closure map which are not defined by the superclass
        // nor the interfaces
        for (Map.Entry<String, Boolean> entry : delegatedClosures.entrySet()) {
            Boolean visited = entry.getValue();
            if (!visited) {
                String name = entry.getKey();
                if (!"*".equals(name)) {
                    // generate a new method
                    visitMethod(ACC_PUBLIC, name, "([Ljava/lang/Object;)Ljava/lang/Object;", null, null);
                }
            }
        }
    }
19573
protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
		if (this.classLoader == null){
			return Class.forName(clazz);
		}

		return Class.forName(clazz, true, this.classLoader);

	}
341775
public static List<Method> getAccessors(Class<?> clazz) {
    if (clazz == null) {
      throw new IllegalArgumentException("The 'clazz' parameter cannot be null.");
    }

    List<Method> methods = new ArrayList<>();
    for (Method method : clazz.getMethods()) {
      String methodName = method.getName();
      if (!"getClass".equals(methodName) && !"hashCode".equals(methodName) && method.getReturnType() != null
          && !Void.class.equals(method.getReturnType()) && method.getParameterTypes().length == 0
          && ((methodName.startsWith("get") && methodName.length() > 3)
              || (methodName.startsWith("is") && methodName.length() > 2)
              || (methodName.startsWith("has") && methodName.length() > 3))) {
        methods.add(method);
      }
    }

    // Order the methods alphabetically by name
    sort(methods, new Comparator<Method>() {
      /**
       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
       */
      @Override
      public int compare(Method method1, Method method2) {
        return method1.getName().compareTo(method2.getName());
      }
    });

    return unmodifiableList(methods);
  }
1364896
public static ClassLoader getClassLoader(Class clazz){
        ClassLoader classLoader = clazz.getClassLoader();
        return classLoader==null ? ClassLoader.getSystemClassLoader() : classLoader;
    }
268828
public <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		if( clazzz == null )
			return null;

		for( Clazz<?> c : clazzz.values() )
			if( c.getReflectedClass() == clazz )
			{
				@SuppressWarnings( "unchecked" )
				Clazz<T> result = (Clazz<T>) c;
				return result;
			}

		return null;
	}
668261
public static ClassLoader getClassLoader(Class<?> clazz) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (loader != null) {
            return loader;
        }
        if (clazz != null) {
            loader = clazz.getClassLoader();
            if (loader != null) {
                return loader;
            }
        }
        return ClassLoader.getSystemClassLoader();
    }
459151
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
        if (clazz == null || methodName == null || methodName.length() == 0) {
            return null;
        }

        for (Class<?> itr = clazz; hasSuperClass(itr); ) {
            Method[] methods = itr.getDeclaredMethods();

            for (Method method : methods) {
                if (method.getName().equals(methodName) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
                    return method;
                }
            }

            itr = itr.getSuperclass();
        }
        return null;
    }
1238851
public static Logger getLogger(Class<?> clazz) {
        return Logger.getLogger(Checker.isNull(clazz) ? LOCAL_CLASS : clazz);
    }
616055
public static <T> T getPrevInstruction(InstructionHandle startHandle, Class<T> clazz) {
        InstructionHandle curHandle = startHandle;
        while (curHandle != null) {
            curHandle = curHandle.getPrev();

            if (curHandle != null && clazz.isInstance(curHandle.getInstruction())) {
                return clazz.cast(curHandle.getInstruction());
            }
        }
        return null;
    }
205943
private static Method getMethod(String methodName, Class<?> clazz, Class<?>... args) {
        Method method;
        try {
            method = clazz.getMethod(methodName, args);
        } catch (NoSuchMethodException e1) {
            method = null;
        }
        return method;
    }
777874
private static Method getInitializeMethod(Class< ? > cl) {
        Method method = null;
        
        try {
            method = cl.getDeclaredMethod(IS_INITIALIZED, new Class[]{Object.class});
        } catch (NoSuchMethodException e) {
			//in this case 'isInitialized' method can't be null
        } 
        return method;		
    }
72178
public static Constructor getConstructor(final String name) throws ClassNotFoundException, NoSuchMethodException {
        Constructor constructor = constructorsCache.get(name);
        if (constructor == null) {
            synchronized (constructorsCache) {
                constructor = constructorsCache.get(name);
                if (constructor == null) {
                    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

                    if (tccl == null) {
                        constructor = Class.forName(name).getDeclaredConstructor();
                    } else {
                        constructor = Class.forName(name, true, tccl).getDeclaredConstructor();
                    }
                    constructorsCache.put(name, constructor);
                }
            }
        }
        return constructor;
    }