Get getDescriptor method source by template.

@param cls the cls
@return the source code for getDescriptor method
773253
public static String descriptorMethodSource(Class cls) {
        String descriptorClsName = ClassHelper.getInternalName(Descriptor.class.getCanonicalName());
        
        String code = "if (this.descriptor != null) {" + ClassCode.LINE_BREAK  +
                            "return this.descriptor;" + ClassCode.LINE_BREAK  +
                       "}" + ClassCode.LINE_BREAK +
                       "%s descriptor = CodedConstant.getDescriptor(%s);" + ClassCode.LINE_BREAK  +
                       "return (this.descriptor = descriptor);"; 
        
        return String.format(code, descriptorClsName, 
                ClassHelper.getInternalName(cls.getCanonicalName()) + CodeGenerator.JAVA_CLASS_FILE_SUFFIX);
        
    }
1315827
public static Method getDeclaredMethod(final Class cls, final String methodName) {
		return getMethod(cls, methodName, true);
	}
664108
static int getClassCode(Class cla) {

        if (!cla.isPrimitive()) {
            return ArrayUtil.CLASS_CODE_OBJECT;
        }

        return classCodeMap.get(cla, -1);
    }
1096986
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = null;
        try {
            cl = Thread.currentThread().getContextClassLoader();
        } catch (Throwable ex) {
            // Cannot access thread context ClassLoader - falling back to system
            // class loader...
        }
        if (cl == null) {
            // No thread context class loader -> use class loader of this class.
            cl = cls.getClassLoader();
        }
        return cl;
    }
749845
public MethodDescriptor[] 
    getTeaContextMethodDescriptors(Class<?>[] contextClasses) {

        Vector<MethodDescriptor> v = new Vector<MethodDescriptor>();
        Hashtable<Method, Method> methods = new Hashtable<Method, Method>();

        if (contextClasses != null) {

            // Combine all of the MethodDescriptors

            for (int i = 0; i < contextClasses.length; i++) {
                Class<?> c = contextClasses[i];
                if (c == null) {
                    continue;
                }

                MethodDescriptor[] mds = 
                    getTeaContextMethodDescriptors(c, false);
                
                for (int j = 0; j < mds.length; j++) {
                    MethodDescriptor md = mds[j];
                    Method m = md.getMethod();
                    // Check uniqueness of method
                    if (methods.get(m) == null) {
                        methods.put(m, m);
                        v.addElement(md);
                    }
                }
            }
        }

        MethodDescriptor[] methodDescriptors = new MethodDescriptor[v.size()];
        v.copyInto(methodDescriptors);

        // Sort the combined results
        sortMethodDescriptors(methodDescriptors);

        return methodDescriptors;
    }
128813
private static List<MethodInfo> getPublicMethodInfos(final JavaClass cls) {
        List<MethodInfo> methodInfos = new ArrayList<>();
        Method[] methods = cls.getMethods();
        for (Method m : methods) {
            if ((m.getAccessFlags() & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) != 0) {
                ExceptionTable et = m.getExceptionTable();
                methodInfos
                        .add(new MethodInfo(m.getName(), m.getSignature(), et == null ? null : et.getExceptionNames()));
            }
        }
        return methodInfos;
    }
837145
private static Map<QMethod, String> getAttributes(JavaClass cls) {
        Map<QMethod, String> atts = new HashMap<>();
        Method[] methods = cls.getMethods();
        for (Method m : methods) {
            String name = m.getName();
            if (name.startsWith("set") && m.isPublic() && !m.isStatic()) {
                String sig = m.getSignature();
                List<String> args = SignatureUtils.getParameterSignatures(sig);
                if ((args.size() == 1) && Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) {
                    String parmSig = args.get(0);
                    if (validAttrTypes.contains(parmSig)) {
                        Code code = m.getCode();
                        if ((code != null) && (code.getCode().length < MAX_ATTRIBUTE_CODE_LENGTH)) {
                            atts.put(new QMethod(name, sig), parmSig);
                        }
                    }
                }
            }
        }
        return atts;
    }
1372387
static Method getMethod(Class<?> cls, String name) throws NoSuchMethodException {
    NoSuchMethodException firstExc = null;
    for (Class<?> c = cls; c != null; c = c.getSuperclass()) {
      try {
        return c.getDeclaredMethod(name);
      } catch (NoSuchMethodException e) {
        if (firstExc == null) {
          firstExc = e;
        }
      }
    }
    throw firstExc;
  }
1315669
def get_class_method(cls_or_inst, method_name):
    
    cls = cls_or_inst if isinstance(cls_or_inst, type) else cls_or_inst.__class__
    meth = getattr(cls, method_name, None)
    if isinstance(meth, property):
        meth = meth.fget
    elif isinstance(meth, cached_property):
        meth = meth.func
    return meth
305390
private static ICodeGenerator getCodeGenerator(Class cls) {
        // check if has default constructor

        if (!cls.isMemberClass()) {
            try {
                cls.getConstructor(new Class<?>[0]);
            } catch (NoSuchMethodException e2) {
                throw new IllegalArgumentException(
                        "Class '" + cls.getName() + "' must has default constructor method with no parameters.", e2);
            } catch (SecurityException e2) {
                throw new IllegalArgumentException(e2.getMessage(), e2);
            }
        }

        ICodeGenerator cg = new TemplateCodeGenerator(cls);

        return cg;
    }
1173965
public static Method[] getDeclaredMethods(Class clazz) {
	Method[] methods = clazz.getMethods();
	ArrayList list = new ArrayList();
	for (int i = 0; i < methods.length; i++) {
	    if (methods[i].getDeclaringClass() == clazz) list.add(methods[i]);
	}
	if (list.size() == 0) return new Method[0];
	return (Method[]) list.toArray(new Method[list.size()]);
    }
816102
public ClassDocImpl getClassDoc(ClassSymbol clazz) {
        ClassDocImpl result = classMap.get(clazz);
        if (result != null) return result;
        if (isAnnotationType(clazz)) {
            result = new AnnotationTypeDocImpl(this, clazz);
        } else {
            result = new ClassDocImpl(this, clazz);
        }
        classMap.put(clazz, result);
        return result;
    }
219308
@Override
	public ZooClass getClass(Class<?> cls) {
		DBTracer.logCall(this, cls);
		checkValidityRead();
		return sm.locateSchema(cls, null);
	}
1089776
private static MethodRef getBuilderMethod(Descriptor descriptor) {
    TypeInfo message = messageRuntimeType(descriptor);
    TypeInfo builder = builderRuntimeType(descriptor);
    return MethodRef.createStaticMethod(
            message, new Method("newBuilder", builder.type(), NO_METHOD_ARGS))
        .asNonNullable();
  }
207914
public static String getPackageName(final Class<?> cls) {
        if (cls == null) {
            return StringUtils.EMPTY;
        }
        return getPackageName(cls.getName());
    }
842211
private static Method getMethod(final Class cls, final String methodName, boolean declared) {
		$.checkNotEmpty(methodName);
		List<Method> methods = getMethodsList(cls, declared);
		for (int i = 0; i < methods.size(); i++) {
			if (methodName.equals(methods.get(i).getName())) {
				return methods.get(i);
			}
		}
		return null;
	}
196301
private Method findFromString(Class<?> cls) {
        // find in declared methods
        Method[] methods = cls.getDeclaredMethods();
        Method matched = null;
        for (Method method : methods) {
            if (!method.isBridge() && !method.isSynthetic()) {
                FromString fromString = method.getAnnotation(FromString.class);
                if (fromString != null) {
                    if (matched != null) {
                        throw new IllegalStateException("Two methods are annotated with @FromString: " + cls.getName());
                    }
                    matched = method;
                }
            }
        }
        // check for factory
        FromStringFactory factory = cls.getAnnotation(FromStringFactory.class);
        if (factory != null) {
            if (matched != null) {
                throw new IllegalStateException("Class annotated with @FromString and @FromStringFactory: " + cls.getName());
            }
            Method[] factoryMethods = factory.factory().getDeclaredMethods();
            for (Method method : factoryMethods) {
                if (!method.isBridge() && !method.isSynthetic()) {
                    // handle factory containing multiple FromString for different types
                    if (cls.isAssignableFrom(method.getReturnType())) {
                        FromString fromString = method.getAnnotation(FromString.class);
                        if (fromString != null) {
                            if (matched != null) {
                                throw new IllegalStateException("Two methods are annotated with @FromString on the factory: " + factory.factory().getName());
                            }
                            matched = method;
                        }
                    }
                }
            }
        }
        return matched;
    }