Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to pair the get methods with a matching set
        /// method. This pairs methods using the Java Bean method name, the
        /// names must match exactly, meaning that the case and value of
        /// the strings must be identical. Also in order for this to succeed
        /// the types for the methods and the annotation must also match.
        /// </summary>
        /// <param name="read">
        /// this is a get method that has been extracted
        /// </param>
        /// <param name="write">
        /// this is the write method to compare details with
        /// </param>
        public void Build(MethodPart read, MethodPart write)
        {
            Annotation label = read.GetAnnotation();
            String     name  = read.GetName();

            if (!write.GetAnnotation().equals(label))
            {
                throw new MethodException("Annotations do not match for '%s' in %s", name, type);
            }
            Class type = read.GetType();

            if (type != write.GetType())
            {
                throw new MethodException("Method types do not match for %s in %s", name, type);
            }
            add(new MethodContact(read, write));
        }