private void processCommandField ( final Field field , String key , String prompt ) { String name = field . getName ( ) ; Class < ? > type = field . getType ( ) ; if ( key . equals ( "" ) ) { key = name ; } if ( prompt != null && prompt . equals ( "" ) ) { prompt = key ; } final ArgumentProcessor < Object > argProcessor = new ArgumentProcessor < Object > ( prompt ) ; argProcessor . setDefaultCommand ( UnrecognizedCommand . getInstance ( ) ) ; argProcessor . processAnnotations ( type ) ; addCommand ( key , new Command < T > ( ) { public void process ( Queue < String > argq , T state ) { try { Object value = field . get ( state ) ; argProcessor . process ( argq , value ) ; } catch ( IllegalArgumentException e ) { throw new UnexpectedException ( e ) ; } catch ( IllegalAccessException e ) { throw new UnexpectedException ( e ) ; } } } ) ; }
Adds a command that passes control to the specified field .