001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.orm.jpa; 018 019import java.util.ArrayList; 020import java.util.Collection; 021import java.util.function.Supplier; 022 023/** 024 * Settings to apply when configuring Hibernate. 025 * 026 * @author Andy Wilkinson 027 * @since 2.0.0 028 */ 029public class HibernateSettings { 030 031 private Supplier<String> ddlAuto; 032 033 private Collection<HibernatePropertiesCustomizer> hibernatePropertiesCustomizers; 034 035 public HibernateSettings ddlAuto(Supplier<String> ddlAuto) { 036 this.ddlAuto = ddlAuto; 037 return this; 038 } 039 040 public String getDdlAuto() { 041 return (this.ddlAuto != null) ? this.ddlAuto.get() : null; 042 } 043 044 public HibernateSettings hibernatePropertiesCustomizers( 045 Collection<HibernatePropertiesCustomizer> hibernatePropertiesCustomizers) { 046 this.hibernatePropertiesCustomizers = new ArrayList<>( 047 hibernatePropertiesCustomizers); 048 return this; 049 } 050 051 public Collection<HibernatePropertiesCustomizer> getHibernatePropertiesCustomizers() { 052 return this.hibernatePropertiesCustomizers; 053 } 054 055}