protected void throwClassificationNotFoundException(String classificationName) {
   final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
   br.addNotice("The classification in the parameter comment option was not found.");
   br.addItem("ParameterBean");
   br.addElement(_pmbMetaData.getClassName());
   br.addItem("Property");
   br.addElement(_propertyName);
   br.addItem("Option");
   br.addElement(OPTION_PREFIX + classificationName + OPTION_SUFFIX);
   final String msg = br.buildExceptionMessage();
   throw new IllegalStateException(msg);
 }
 protected void throwCommonColumnMapRelatedTableNotFoundException() {
   final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
   br.addNotice("The table related to common columns was not found.");
   br.addItem("Advice");
   br.addElement("At least one table should be related to common columns.");
   br.addElement("The definition might contain a non-existent common column.");
   br.addElement("Make sure your definition is correct.");
   br.addElement("");
   br.addElement("And DBFlute cannot detect the common columns");
   br.addElement("of tables without PK, so check about it too");
   br.addItem("Common Column");
   br.addElement(getCommonColumnNameList());
   final String msg = br.buildExceptionMessage();
   throw new DfCommonColumnMapRelatedTableNotFoundException(msg);
 }
Exemplo n.º 3
0
 protected void throwJsonPropertyUnknownClassificationCodeException(
     String code, JsonReader in, ClassificationUnknownCodeException e) {
   final String propertyPath = in.getPath();
   final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
   br.addNotice("Unknown classification code for the JSON property.");
   br.addItem("Advice");
   br.addElement("Make sure your classification code in requested JSON.");
   br.addElement("And confirm the classification elements.");
   br.addItem("Classification");
   br.addElement(clsType);
   br.addItem("Unknown Code");
   br.addElement(code);
   br.addItem("JSON Property");
   br.addElement(propertyPath);
   final String msg = br.buildExceptionMessage();
   throw new JsonPropertyClassificationCodeUnknownException(msg, clsType, propertyPath, e);
 }
Exemplo n.º 4
0
 protected void throwJsonPropertyClassificationCodeOfMethodNotFoundException(
     String code, JsonReader in, ClassificationCodeOfMethodNotFoundException e) {
   final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
   br.addNotice("Not found the codeOf() in the classification type for the JSON property.");
   br.addItem("Advice");
   br.addElement("The classification type of JSON property should have the codeOf() method.");
   br.addElement("And you should use CDef type that always has the method.");
   br.addElement("For example:");
   br.addElement("  (x)");
   br.addElement("    public String memberName;");
   br.addElement("    public Classification memberStatus;    // *NG");
   br.addElement("  (o)");
   br.addElement("    public String memberName;");
   br.addElement("    public CDef.MemberStatus memberStatus; // OK");
   br.addItem("Classification");
   br.addElement(clsType);
   br.addItem("Specified Code");
   br.addElement(code);
   br.addItem("JSON Property");
   br.addElement(in.getPath());
   final String msg = br.buildExceptionMessage();
   throw new JsonPropertyClassificationCodeOfMethodNotFoundException(msg, e);
 }
 protected String extractClassificationNameFromOption(boolean check) {
   if (_extracted) {
     return _specifiedValue;
   }
   _extracted = true;
   final String pmbMetaDataPropertyOption = getPmbMetaDataPropertyOption();
   if (pmbMetaDataPropertyOption == null) {
     if (check) {
       String msg = "The property name didn't have its option:";
       msg = msg + " " + _pmbMetaData.getClassName() + "." + _propertyName;
       throw new IllegalStateException(msg);
     } else {
       return null;
     }
   }
   String option = pmbMetaDataPropertyOption.trim();
   {
     if (option.trim().length() == 0) {
       if (check) {
         String msg = "The option of the property name should not be empty:";
         msg = msg + " property=" + _pmbMetaData.getClassName() + "." + _propertyName;
         throw new IllegalStateException(msg);
       } else {
         return null;
       }
     }
     final List<String> splitOption = splitOption(option);
     String firstOption = null;
     for (String element : splitOption) {
       if (element.startsWith(OPTION_PREFIX) && element.endsWith(OPTION_SUFFIX)) {
         firstOption = element;
         break;
       }
     }
     if (firstOption == null) {
       if (check) {
         String msg = "The option of class name and the property name should be 'cls(xxx)':";
         msg =
             msg + " property=" + _pmbMetaData.getClassName() + "." + _propertyName + ":" + option;
         throw new IllegalStateException(msg);
       } else {
         return null;
       }
     }
     option = firstOption;
   }
   final int clsIdx = OPTION_PREFIX.length();
   final int clsEndIdx = option.length() - OPTION_SUFFIX.length();
   try {
     _specifiedValue = option.substring(clsIdx, clsEndIdx);
   } catch (StringIndexOutOfBoundsException e) {
     final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
     br.addNotice("The classification option for the parameter comment was invalid.");
     br.addItem("ParameterBean");
     br.addElement(_pmbMetaData.getClassName());
     br.addItem("Property");
     br.addElement(_propertyName);
     br.addItem("Option");
     br.addElement(option);
     br.addItem("Exception");
     br.addElement(e.getClass());
     br.addElement(e.getMessage());
     br.addElement("{" + option + "}.substring(" + clsIdx + ", " + clsEndIdx + ")");
     final String msg = br.buildExceptionMessage();
     throw new IllegalStateException(msg, e);
   }
   return _specifiedValue;
 }