Beispiel #1
0
 public static JavaType convertPrimitiveType(final JavaType type, final boolean convertVoid) {
   if (!convertVoid && JavaType.VOID_PRIMITIVE.equals(type)) {
     return type;
   }
   if (type != null && type.isPrimitive()) {
     return new JavaType(type.getFullyQualifiedTypeName());
   }
   return type;
 }
 public boolean isPrimitive() {
   return type.isPrimitive()
       || isDate()
       || isString()
       || isBoolean()
       || type.equals(JavaType.DOUBLE_OBJECT)
       || type.equals(LONG_OBJECT)
       || type.equals(JavaType.INT_OBJECT)
       || type.equals(JavaType.FLOAT_OBJECT)
       || type.equals(JavaType.BYTE_OBJECT)
       || type.equals(JavaType.SHORT_OBJECT)
       || type.equals(JavaType.CHAR_OBJECT)
       || type.equals(BIG_DECIMAL);
 }
  @Override
  public boolean isNullRequiredVisibleForFieldNumber(ShellContext shellContext) {

    // Check if `notNull`is specified
    String notNullParam = shellContext.getParameters().get("notNull");
    if (notNullParam != null) {
      return false;
    }

    // Check if type is primitive
    String typeValue = shellContext.getParameters().get("type");
    if (StringUtils.isNotBlank(typeValue)) {
      JavaType numberType =
          getJavaTypeConverter().convertFromText(typeValue, JavaType.class, "java-number");
      if (numberType.isPrimitive()) {
        return false;
      }
    }
    return true;
  }