1 /*
2 * Copyright 2001-2013 Stephen Colebourne
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.joda.beans.impl.direct;
17
18 import org.joda.beans.impl.BasicBeanBuilder;
19
20 /**
21 * Implementation of {@code BeanBuilder} that validates the resulting bean.
22 * <p>
23 * This implementation ensures that all the setters are called.
24 *
25 * @author Stephen Colebourne
26 * @param <T> the bean type
27 */
28 public class DirectBeanBuilder<T extends DirectBean> extends BasicBeanBuilder<T> {
29
30 /**
31 * Constructs the builder wrapping the target bean.
32 *
33 * @param bean the target bean, not null
34 */
35 public DirectBeanBuilder(T bean) {
36 super(bean);
37 }
38
39 //-----------------------------------------------------------------------
40 @Override
41 protected void validate(T bean) {
42 bean.validate();
43 }
44
45 }