public static Object tryGetSingleton ( Class < ? > invokerClass , App app ) { Object singleton = app . singleton ( invokerClass ) ; if ( null == singleton ) { if ( isGlobalOrStateless ( invokerClass , new HashSet < Class > ( ) ) ) { singleton = app . getInstance ( invokerClass ) ; } } if ( null != singleton ) { app . registerSingleton ( singleton ) ; } return singleton ; }
If the invokerClass specified is singleton or without field or all fields are stateless then return an instance of the invoker class . Otherwise return null