private void init()

in hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/AnnotationSerializer.java [166:202]


    private void init(Class cl) {
        synchronized (this) {
            if (_annType != null)
                return;

            _annType = cl;

            ArrayList methods = new ArrayList();

            for (Method method : _annType.getDeclaredMethods()) {
                if (method.getName().equals("hashCode")
                        || method.getName().equals("toString")
                        || method.getName().equals("annotationType")) {
                    continue;
                }

                if (method.getParameterTypes().length != 0)
                    continue;

                methods.add(method);

                method.setAccessible(true);
            }

            if (_annType == null)
                throw new IllegalStateException(cl.getName() + " is invalid because it does not have a valid annotationType()");

            _methods = new Method[methods.size()];
            methods.toArray(_methods);

            _methodSerializers = new MethodSerializer[_methods.length];

            for (int i = 0; i < _methods.length; i++) {
                _methodSerializers[i] = getMethodSerializer(_methods[i].getReturnType());
            }
        }
    }