public Action build ( Class < ? > cls ) { EdmAction edmAction = cls . getAnnotation ( EdmAction . class ) ; EdmReturnType edmReturnType = cls . getAnnotation ( EdmReturnType . class ) ; Set < Parameter > parameters = new HashSet <> ( ) ; for ( Field field : cls . getDeclaredFields ( ) ) { EdmParameter parameterAnnotation = field . getAnnotation ( EdmParameter . class ) ; if ( parameterAnnotation != null ) { String parameterName = isNullOrEmpty ( parameterAnnotation . name ( ) ) ? field . getName ( ) : parameterAnnotation . name ( ) ; String parameterType = isNullOrEmpty ( parameterAnnotation . type ( ) ) ? field . getType ( ) . getSimpleName ( ) : parameterAnnotation . type ( ) ; parameters . add ( new ParameterImpl . Builder ( ) . setMaxLength ( parameterAnnotation . maxLength ( ) ) . setName ( parameterName ) . setNullable ( parameterAnnotation . nullable ( ) ) . setPrecision ( parameterAnnotation . precision ( ) ) . setScale ( parameterAnnotation . scale ( ) ) . setSRID ( parameterAnnotation . srid ( ) ) . setType ( parameterType ) . setUnicode ( parameterAnnotation . unicode ( ) ) . setJavaField ( field ) . build ( ) ) ; } } return new ActionImpl . Builder ( ) . setName ( getTypeName ( edmAction , cls ) ) . setNamespace ( getNamespace ( edmAction , cls ) ) . setBound ( edmAction . isBound ( ) ) . setEntitySetPath ( edmAction . entitySetPath ( ) ) . setParameters ( parameters ) . setReturnType ( edmReturnType . type ( ) ) . setJavaClass ( cls ) . build ( ) ; }
Builds an action instance from given class .