Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
 package org.dbflute.s2dao.metadata;
 
 import java.util.List;
 import java.util.Map;

Author(s):
modified by jflute (originated in S2Dao)
 
 public class TnProcedureMetaData {
 
     // ===================================================================================
     //                                                                           Attribute
     //                                                                           =========
     private final String _procedureName;
     private List<TnProcedureParameterType_bindParameterTypeList// lazy load
     private List<TnProcedureParameterType_notParamResultTypeList// lazy load
     private boolean _fixed;
 
         return new HashMap<StringTnProcedureParameterType>(); // unordered
     }
 
         return new TreeSet<TnProcedureParameterType>(new Comparator<TnProcedureParameterType>() {
             public int compare(TnProcedureParameterType o1TnProcedureParameterType o2) {
                 return o1.getParameterOrder().compareTo(o2.getParameterOrder());
             }
         });
     }
 
     // ===================================================================================
     //                                                                         Constructor
     //                                                                         ===========
     public TnProcedureMetaData(final String procedureName) {
         this. = procedureName;
     }
 
     // ===================================================================================
     //                                                                             Factory
     //                                                                             =======
     public String createSql() {
         final StringBuilder sb = new StringBuilder();
         sb.append("{");
         final int argSize;
         {
             final int bindSize = getBindParameterTypeList().size();
             if (hasReturnParameterType()) {
                 sb.append("? = ");
                 argSize = bindSize - 1;
             } else {
                 argSize = bindSize;
             }
         }
         sb.append("call ").append(getProcedureName()).append("(");
         for (int i = 0; i < argSizei++) {
             sb.append("?, ");
         }
         if (argSize > 0) {
             sb.setLength(sb.length() - 2);
         }
         sb.append(")}");
         return sb.toString();
     }
 
     // ===================================================================================
     //                                                                                 Fix
     //                                                                                 ===
     public void fix() {
          = true;
         getBindParameterTypeList(); // for lazy-loading
         getNotParamResultTypeList(); // for lazy-loading
     }
 
     // ===================================================================================
     //                                                                            Accessor
     //                                                                            ========
    public String getProcedureName() {
        return ;
    }
        return ;
    }
        if ( != null) {
            return ;
        }
        final SortedSet<TnProcedureParameterTypeparameterTypeSortedSet = getParameterTypeSortedSet();
        final List<TnProcedureParameterTypebindList = new ArrayList<TnProcedureParameterType>();
        for (TnProcedureParameterType ppt : parameterTypeSortedSet) {
            if (!ppt.isNotParamResultType()) {
                bindList.add(ppt);
            }
        }
         = bindList;
        return bindList;
    }
        if ( != null) {
            return ;
        }
        final SortedSet<TnProcedureParameterTypeparameterTypeSortedSet = getParameterTypeSortedSet();
        final List<TnProcedureParameterTyperesultList = new ArrayList<TnProcedureParameterType>();
        for (TnProcedureParameterType ppt : parameterTypeSortedSet) {
            if (ppt.isNotParamResultType()) {
                resultList.add(ppt);
            }
        }
         = resultList;
        return resultList;
    }
    public boolean hasReturnParameterType() {
        return  != null;
    }
        return ;
    }
    public void addParameterType(TnProcedureParameterType parameterType) {
        if (parameterType == null) {
            String msg = "The argument 'parameterType' should not be null!";
            throw new IllegalStateException(msg);
        }
        if () {
            String msg = "This object has already been fixed:";
            msg = msg + " added=" + parameterType.getParameterName();
            throw new IllegalStateException(msg);
        }
        final String name = parameterType.getParameterName();
        .put(nameparameterType);
        .add(parameterType);
        if (parameterType.isReturnType()) {
             = parameterType;
        }
    }
New to GrepCode? Check out our FAQ X