C# Класс SimpleFramework.Xml.Core.MethodPartFactory

The MethodPartFactory is used to create method parts based on the method signature and the XML annotation. This is effectively where a method is classified as either a getter or a setter method within an object. In order to determine the type of method the method name is checked to see if it is prefixed with either the "get", "is", or "set" tokens.

Once the method is determined to be a Java Bean method according to conventions the method signature is validated. If the method signature does not follow a return type with no arguments for the get method, and a single argument for the set method then this will throw an exception.

Показать файл Открыть проект

Открытые методы

Метод Описание
GetAnnotation ( Method method ) : Annotation

This is used to synthesize an XML annotation given a method. The provided method must follow the Java Bean conventions and either be a getter or a setter. If this criteria is satisfied then a suitable XML annotation is created to be used. Typically a match is performed on whether the method type is a Java collection or an array, if neither criteria are true a normal XML element is used. Synthesizing in this way ensures the best results.

GetInstance ( Method method ) : MethodPart

This is used to acquire a MethodPart for the method provided. This will synthesize an XML annotation to be used for the method. If the method provided is not a setter or a getter then this will return null, otherwise it will return a part with a synthetic XML annotation. In order to be considered a valid method the Java Bean conventions must be followed by the method.

GetInstance ( Method method, Annotation label ) : MethodPart

This is used to acquire a MethodPart 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.

GetMethodType ( Method method ) : MethodType

This is used to acquire a MethodType for the name of the method provided. This will determine the method type by examining its prefix. If the name follows Java Bean conventions then either a setter method type is returned. If the name does not comply with the naming conventions then null is returned.

GetName ( Method method, Annotation label ) : MethodName

This is used to acquire a MethodName 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 name or a getter method name is returned. If the method does not comply with the conventions an exception is thrown.

GetParameterType ( Method method ) : Class

This is the parameter type associated with the provided method. The first parameter is returned if the provided method is a setter. If the method takes more than one parameter or if it takes no parameters then null is returned from this.

GetRead ( Method method, MethodType type ) : MethodName

This is used to acquire a MethodName for the name and annotation of the provided method. This must be a getter method, and so must have a return type that is not void and have not arguments. If the method has arguments an exception is thrown, if not the Java Bean method name is provided.

GetReturnType ( Method method ) : Class

This is the return type associated with the provided method. The return type of the method is provided only if the method adheres to the Java Bean conventions regarding getter methods. If the method takes a parameter then this will return null.

GetType ( Method method ) : Class

This is used to extract the type from a method. Type type of a method is the return type for a getter and a parameter type for a setter. Such a parameter will only be returned if the method observes the Java Bean conventions for a property method.

GetTypeName ( String name, MethodType type ) : String

This is used to acquire the name of the method in a Java Bean property style. Thus any "get", "is", or "set" prefix is removed from the name and the following character is changed to lower case if it does not represent an acronym.

GetWrite ( Method method, MethodType type ) : MethodName

This is used to acquire a MethodName for the name and annotation of the provided method. This must be a setter method, and so must accept a single argument, if it contains more or less than one argument an exception is thrown. return type that is not void and

MethodPartFactory ( ) : System

Constructor for the MethodPartFactory object. This is used to create method parts based on the method signature and the XML annotation is uses. The created part can be used to either set or get values depending on its type.

Описание методов

GetAnnotation() публичный Метод

This is used to synthesize an XML annotation given a method. The provided method must follow the Java Bean conventions and either be a getter or a setter. If this criteria is satisfied then a suitable XML annotation is created to be used. Typically a match is performed on whether the method type is a Java collection or an array, if neither criteria are true a normal XML element is used. Synthesizing in this way ensures the best results.
public GetAnnotation ( Method method ) : Annotation
method Method /// this is the method to extract the annotation for ///
Результат Annotation

GetInstance() публичный Метод

This is used to acquire a MethodPart for the method provided. This will synthesize an XML annotation to be used for the method. If the method provided is not a setter or a getter then this will return null, otherwise it will return a part with a synthetic XML annotation. In order to be considered a valid method the Java Bean conventions must be followed by the method.
public GetInstance ( Method method ) : MethodPart
method Method /// this is the method to acquire the part for ///
Результат MethodPart

GetInstance() публичный Метод

This is used to acquire a MethodPart 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.
public GetInstance ( Method method, Annotation label ) : MethodPart
method Method /// this is the method to acquire the part for ///
label Annotation /// this is the annotation associated with the method ///
Результат MethodPart

GetMethodType() публичный Метод

This is used to acquire a MethodType for the name of the method provided. This will determine the method type by examining its prefix. If the name follows Java Bean conventions then either a setter method type is returned. If the name does not comply with the naming conventions then null is returned.
public GetMethodType ( Method method ) : MethodType
method Method /// this is the method to acquire the type for ///
Результат MethodType

GetName() публичный Метод

This is used to acquire a MethodName 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 name or a getter method name is returned. If the method does not comply with the conventions an exception is thrown.
public GetName ( Method method, Annotation label ) : MethodName
method Method /// this is the method to acquire the name for ///
label Annotation /// this is the annotation associated with the method ///
Результат MethodName

GetParameterType() публичный Метод

This is the parameter type associated with the provided method. The first parameter is returned if the provided method is a setter. If the method takes more than one parameter or if it takes no parameters then null is returned from this.
public GetParameterType ( Method method ) : Class
method Method /// this is the method to get the parameter type for ///
Результат Class

GetRead() публичный Метод

This is used to acquire a MethodName for the name and annotation of the provided method. This must be a getter method, and so must have a return type that is not void and have not arguments. If the method has arguments an exception is thrown, if not the Java Bean method name is provided.
public GetRead ( Method method, MethodType type ) : MethodName
method Method /// this is the method to acquire the name for ///
type MethodType /// this is the method type to acquire the name for ///
Результат MethodName

GetReturnType() публичный Метод

This is the return type associated with the provided method. The return type of the method is provided only if the method adheres to the Java Bean conventions regarding getter methods. If the method takes a parameter then this will return null.
public GetReturnType ( Method method ) : Class
method Method /// this is the method to get the return type for ///
Результат Class

GetType() публичный Метод

This is used to extract the type from a method. Type type of a method is the return type for a getter and a parameter type for a setter. Such a parameter will only be returned if the method observes the Java Bean conventions for a property method.
public GetType ( Method method ) : Class
method Method /// this is the method to acquire the type for ///
Результат Class

GetTypeName() публичный Метод

This is used to acquire the name of the method in a Java Bean property style. Thus any "get", "is", or "set" prefix is removed from the name and the following character is changed to lower case if it does not represent an acronym.
public GetTypeName ( String name, MethodType type ) : String
name String /// this is the name of the method to be converted ///
type MethodType /// this is the type of method the name represents ///
Результат String

GetWrite() публичный Метод

This is used to acquire a MethodName for the name and annotation of the provided method. This must be a setter method, and so must accept a single argument, if it contains more or less than one argument an exception is thrown. return type that is not void and
public GetWrite ( Method method, MethodType type ) : MethodName
method Method /// this is the method to acquire the name for ///
type MethodType /// this is the method type to acquire the name for ///
Результат MethodName

MethodPartFactory() публичный Метод

Constructor for the MethodPartFactory object. This is used to create method parts based on the method signature and the XML annotation is uses. The created part can be used to either set or get values depending on its type.
public MethodPartFactory ( ) : System
Результат System