001/*
002 *  Copyright (c) 2022-2025, Mybatis-Flex (fuhai999@gmail.com).
003 *  <p>
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 *  <p>
008 *  http://www.apache.org/licenses/LICENSE-2.0
009 *  <p>
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 */
016package com.mybatisflex.core.query;
017
018import com.mybatisflex.core.dialect.IDialect;
019import com.mybatisflex.core.exception.FlexExceptions;
020
021public class WithStringDetail implements WithDetail {
022
023    private String rawSQL;
024    private Object[] params;
025
026    public WithStringDetail(String rawSQL, Object[] params) {
027        this.rawSQL = rawSQL;
028        this.params = params;
029    }
030
031    public String getRawSQL() {
032        return rawSQL;
033    }
034
035    public void setRawSQL(String rawSQL) {
036        this.rawSQL = rawSQL;
037    }
038
039    public Object[] getParams() {
040        return params;
041    }
042
043    public void setParams(Object[] params) {
044        this.params = params;
045    }
046
047    @Override
048    public String toSql(IDialect dialect) {
049        return rawSQL;
050    }
051
052    @Override
053    public Object[] getParamValues() {
054        return params;
055    }
056
057    @Override
058    public WithStringDetail clone() {
059        try {
060            return (WithStringDetail) super.clone();
061        } catch (CloneNotSupportedException e) {
062            throw FlexExceptions.wrap(e);
063        }
064    }
065
066}