@ Override public String getAlias ( Class < ? > clazz ) { // Locate the alias of the requested class. String alias = JSONUtil . getAlias ( clazz ) ; // If not found, ensure that the class has been loaded to allow for its // static initializers to execute, then try again. if ( alias == null ) { try { Class . forName ( clazz . getName ( ) ) ; } catch ( ClassNotFoundException e ) { throw MiscUtil . toUnchecked ( e ) ; } alias = JSONUtil . getAlias ( clazz ) ; } return alias ; }
Returns the alias for the domain class . A domain class will typically register its alias in a static initializer block . If the initial attempt to retrieve an alias fails this method forces the class loader to load the class to ensure that any static initializers are executed and then tries again .