The MethodName object is used to represent the name of a Java Bean method. This contains the Java Bean name the type and the actual method it represents. This allows the scanner to create MethodPart objects based on the method type.
Beispiel #1
0
        /// <summary>
        /// This is used to acquire a <c>MethodPart</c> for the name
        /// and annotation of the provided method. This will determine the
        /// method type by examining its signature. If the method follows
        /// Java Bean conventions then either a setter method part or a
        /// getter method part is returned. If the method does not comply
        /// with the conventions an exception is thrown.
        /// </summary>
        /// <param name="method">
        /// this is the method to acquire the part for
        /// </param>
        /// <param name="label">
        /// this is the annotation associated with the method
        /// </param>
        /// <returns>
        /// this is the method part object for the method
        /// </returns>
        public MethodPart GetInstance(Method method, Annotation label)
        {
            MethodName name = GetName(method, label);
            MethodType type = name.GetType();

            if (type == MethodType.SET)
            {
                return(new SetPart(name, label));
            }
            return(new GetPart(name, label));
        }
Beispiel #2
0
 /// <summary>
 /// Constructor for the <c>GetPart</c> object. This is
 /// used to create a method part that will provide a means for
 /// the serialization process to set a value to a object.
 /// </summary>
 /// <param name="method">
 /// the method that is used to get the value
 /// </param>
 /// <param name="label">
 /// this describes how to serialize the value
 /// </param>
 public GetPart(MethodName method, Annotation label) {
    this.method = method.Method;
    this.name = method.Name;
    this.type = method.Type;
    this.label = label;
 }