public <T> Model<T> get(Class<T> type) { Model m = models.get(type); if(m==null) { synchronized(this) { m = models.get(type); if(m==null) m = new Model<T>(this,type); } } return m; } }
/** * Instead of throwing {@link NotExportableException} this method will return null * This should be used on hot paths where throwing the exception and catching it would incur a performance hit * @return model * @since 1.253 */ @CheckForNull public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) { Model<T> m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); } return m; } }
/** * Instead of throwing {@link NotExportableException} this method will return null * This should be used on hot paths where throwing the exception and catching it would incur a performance hit * @return model * @since 1.253 */ @CheckForNull public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) { Model<T> m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); } return m; } }