private static Map < QMethod , String > getAttributes ( JavaClass cls ) { Map < QMethod , String > atts = new HashMap <> ( ) ; Method [ ] methods = cls . getMethods ( ) ; for ( Method m : methods ) { String name = m . getName ( ) ; if ( name . startsWith ( "set" ) && m . isPublic ( ) && ! m . isStatic ( ) ) { String sig = m . getSignature ( ) ; List < String > args = SignatureUtils . getParameterSignatures ( sig ) ; if ( ( args . size ( ) == 1 ) && Values . SIG_VOID . equals ( SignatureUtils . getReturnSignature ( sig ) ) ) { String parmSig = args . get ( 0 ) ; if ( validAttrTypes . contains ( parmSig ) ) { Code code = m . getCode ( ) ; if ( ( code != null ) && ( code . getCode ( ) . length < MAX_ATTRIBUTE_CODE_LENGTH ) ) { atts . put ( new QMethod ( name , sig ) , parmSig ) ; } } } } } return atts ; }
collect all possible attributes given the name of methods available .