public static < T > T createModel ( Class < T > model , List < OpenEngSBModelEntry > entries ) { if ( ! ModelWrapper . isModel ( model ) ) { throw new IllegalArgumentException ( "The given class is no model" ) ; } try { T instance = model . newInstance ( ) ; for ( OpenEngSBModelEntry entry : entries ) { if ( tryToSetValueThroughField ( entry , instance ) ) { continue ; } if ( tryToSetValueThroughSetter ( entry , instance ) ) { continue ; } ( ( OpenEngSBModel ) instance ) . addOpenEngSBModelEntry ( entry ) ; } return instance ; } catch ( InstantiationException e ) { LOGGER . error ( "InstantiationException while creating a new model instance." , e ) ; } catch ( IllegalAccessException e ) { LOGGER . error ( "IllegalAccessException while creating a new model instance." , e ) ; } catch ( SecurityException e ) { LOGGER . error ( "SecurityException while creating a new model instance." , e ) ; } return null ; }
Creates a model of the given type and uses the list of OpenEngSBModelEntries as initialization data .