1 /*
2 * Copyright 2016-2026 the original author or authors.
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 * https://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.mybatis.dynamic.sql.dsl;
17
18 import org.jspecify.annotations.Nullable;
19 import org.mybatis.dynamic.sql.SqlTable;
20 import org.mybatis.dynamic.sql.update.UpdateModel;
21
22 public class UpdateDSL extends AbstractUpdateDSL<UpdateModel, UpdateDSL> {
23 private UpdateDSL(SqlTable table, @Nullable String tableAlias) {
24 super(table, tableAlias);
25 }
26
27 /**
28 * WARNING! Calling this method could result in an update statement that updates
29 * all rows in a table.
30 *
31 * @return the update model
32 */
33 @Override
34 public UpdateModel build() {
35 return buildUpdateModel();
36 }
37
38 @Override
39 protected UpdateDSL getThis() {
40 return this;
41 }
42
43 public static UpdateDSL update(SqlTable table, String tableAlias) {
44 return new UpdateDSL(table, tableAlias);
45 }
46
47 public static UpdateDSL update(SqlTable table) {
48 return new UpdateDSL(table, null);
49 }
50 }