当前位置: 首页>>代码示例>>Java>>正文


Java TypeName.LONG属性代码示例

本文整理汇总了Java中com.squareup.javapoet.TypeName.LONG属性的典型用法代码示例。如果您正苦于以下问题:Java TypeName.LONG属性的具体用法?Java TypeName.LONG怎么用?Java TypeName.LONG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.squareup.javapoet.TypeName的用法示例。


在下文中一共展示了TypeName.LONG属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bestGuess

private static TypeName bestGuess(String type) {
  switch (type) {
    case "void": return TypeName.VOID;
    case "boolean": return TypeName.BOOLEAN;
    case "byte": return TypeName.BYTE;
    case "char": return TypeName.CHAR;
    case "double": return TypeName.DOUBLE;
    case "float": return TypeName.FLOAT;
    case "int": return TypeName.INT;
    case "long": return TypeName.LONG;
    case "short": return TypeName.SHORT;
    default:
      int left = type.indexOf('<');
      if (left != -1) {
        ClassName typeClassName = ClassName.bestGuess(type.substring(0, left));
        List<TypeName> typeArguments = new ArrayList<>();
        do {
          typeArguments.add(WildcardTypeName.subtypeOf(Object.class));
          left = type.indexOf('<', left + 1);
        } while (left != -1);
        return ParameterizedTypeName.get(typeClassName,
            typeArguments.toArray(new TypeName[typeArguments.size()]));
      }
      return ClassName.bestGuess(type);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:BindingSet.java

示例2: defaultValue

private String defaultValue(JsonProperty property, TypeName type) {
  if (property.defaultValue != null) {
    return property.defaultValue;
  }
  if (type == TypeName.BOOLEAN) {
    return "false";
  } else if (type == TypeName.BYTE) {
    return "(byte) 0";
  } else if (type == TypeName.SHORT) {
    return "0";
  } else if (type == TypeName.INT) {
    return "0";
  } else if (type == TypeName.LONG) {
    return "0L";
  } else if (type == TypeName.CHAR) {
    return "'\0'";
  } else if (type == TypeName.FLOAT) {
    return "0.0f";
  } else if (type == TypeName.DOUBLE) {
    return "0.0d";
  } else {
    return "null";
  }
}
 
开发者ID:setheclark,项目名称:auto-value-json,代码行数:24,代码来源:AutoValueJsonExtension.java

示例3: convertClass

private static TypeName convertClass(String originClazz) {
    switch (originClazz) {
        case "int":
            return TypeName.INT;
        case "long":
            return TypeName.LONG;
        case "float":
            return TypeName.FLOAT;
        case "double":
            return TypeName.DOUBLE;
        case "short":
            return TypeName.SHORT;
        case "boolean":
            return TypeName.BOOLEAN;
        case "char":
            return TypeName.CHAR;
        default:
            return ClassName.bestGuess(originClazz);
    }
}
 
开发者ID:bboylin,项目名称:D-Router,代码行数:20,代码来源:RouterProcessor.java

示例4: mapTypeToCursorGetMethod

private String mapTypeToCursorGetMethod(TypeName typeName) {
    if (typeName == TypeName.BOOLEAN) {
        return "getInt";
    } else if (typeName == TypeName.SHORT) {
        return "getShort";
    } else if (typeName == TypeName.INT) {
        return "getInt";
    } else if (typeName == TypeName.LONG) {
        return "getLong";
    } else if (typeName == TypeName.FLOAT) {
        return "getFloat";
    } else if (typeName == TypeName.DOUBLE) {
        return "getDouble";
    }
    return "";
}
 
开发者ID:Neristance,项目名称:slimorm,代码行数:16,代码来源:SlimOrmProcessor.java

示例5: classToTypeName

public static TypeName classToTypeName(Class scalar) {
    if (scalar.isPrimitive()) {
        switch (scalar.getSimpleName()) {
            case "int":
                return TypeName.INT;

            case "boolean":
                return TypeName.BOOLEAN;

            case "double":
                return TypeName.DOUBLE;

            case "float":
                return TypeName.FLOAT;

            case "byte":
                return TypeName.BYTE;

            case "char":
                return TypeName.CHAR;

            case "short":
                return TypeName.SHORT;

            case "long":
                return TypeName.LONG;

            case "void":
                return TypeName.VOID; // ?

            default:
                throw new GenerationException("can't handle type: " + scalar);
        }
    } else {
        return ClassName.get(scalar);
    }
}
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:37,代码来源:Scalars.java

示例6: getFieldType

public static String getFieldType(VariableElement variableElement) {
    TypeName typeName = getFieldClass(variableElement);
    if (typeName == TypeName.INT || typeName == TypeName.BOOLEAN || typeName == TypeName.BYTE) {
        return "Int";
    } else if (typeName == TypeName.LONG) {
        return "Long";
    } else if (typeName == TypeName.FLOAT) {
        return "Float";
    } else if (typeName == TypeName.DOUBLE) {
        return "Double";
    } else if (ClassName.get(String.class).equals(typeName)) {
        return "String";
    }
    return "";
}
 
开发者ID:florent37,项目名称:RxAndroidOrm,代码行数:15,代码来源:ProcessUtils.java

示例7: getFieldTableType

public static String getFieldTableType(Element variableElement) {
    TypeName typeName = getFieldClass(variableElement);
    if (typeName == TypeName.INT
        || typeName == TypeName.BOOLEAN
        || typeName == TypeName.LONG
        || typeName == TypeName.BYTE) {
        return "integer";
    }
    if (typeName == TypeName.FLOAT) {
        return "real";
    } else if (ClassName.get(String.class).equals(typeName) || isDate(typeName)) {
        return "text";
    }
    return null;
}
 
开发者ID:florent37,项目名称:RxAndroidOrm,代码行数:15,代码来源:ProcessUtils.java

示例8: bestGuess

public static TypeName bestGuess(String type) {
    switch (type) {
        case "void":
            return TypeName.VOID;
        case "boolean":
            return TypeName.BOOLEAN;
        case "byte":
            return TypeName.BYTE;
        case "char":
            return TypeName.CHAR;
        case "double":
            return TypeName.DOUBLE;
        case "float":
            return TypeName.FLOAT;
        case "int":
            return TypeName.INT;
        case "long":
            return TypeName.LONG;
        case "short":
            return TypeName.SHORT;
        default:
            int left = type.indexOf('<');
            if (left != -1) {
                ClassName typeClassName = ClassName.bestGuess(type.substring(0, left));
                List<TypeName> typeArguments = new ArrayList<>();
                do {
                    typeArguments.add(WildcardTypeName.subtypeOf(Object.class));
                    left = type.indexOf('<', left + 1);
                } while (left != -1);
                return ParameterizedTypeName.get(typeClassName,
                        typeArguments.toArray(new TypeName[typeArguments.size()]));
            }
            return ClassName.bestGuess(type);
    }
}
 
开发者ID:wangjiegulu,项目名称:RapidRouter,代码行数:35,代码来源:EasyType.java

示例9: bestGuessDeep

/**
 * @param type
 * @return
 */
public static TypeName bestGuessDeep(String type) {
    switch (type) {
        case "void":
            return TypeName.VOID;
        case "boolean":
            return TypeName.BOOLEAN;
        case "byte":
            return TypeName.BYTE;
        case "char":
            return TypeName.CHAR;
        case "double":
            return TypeName.DOUBLE;
        case "float":
            return TypeName.FLOAT;
        case "int":
            return TypeName.INT;
        case "long":
            return TypeName.LONG;
        case "short":
            return TypeName.SHORT;
        default:
            int left = type.indexOf('<');
            int right = type.indexOf('>');
            if (-1 != left && -1 != right) {
                ClassName typeClassName = ClassName.bestGuess(type.substring(0, left));
                List<TypeName> typeArguments = new ArrayList<>();
                do {
                    typeArguments.add(WildcardTypeName.subtypeOf(bestGuess(type.substring(left + 1, right))));
                    left = type.indexOf('<', left + 1);
                    right = type.indexOf('>', right - 1);
                } while (left != -1);
                return ParameterizedTypeName.get(typeClassName,
                        typeArguments.toArray(new TypeName[typeArguments.size()]));
            }
            return ClassName.bestGuess(type);
    }
}
 
开发者ID:wangjiegulu,项目名称:RapidRouter,代码行数:41,代码来源:EasyType.java

示例10: getTypeName

public static TypeName getTypeName(String type){
    switch (type){
        case NAME_int:
            return TypeName.INT;

        case NAME_long:
            return TypeName.LONG;

        case NAME_short:
            return TypeName.SHORT;

        case NAME_byte:
            return TypeName.BYTE;

        case NAME_boolean:
            return TypeName.BOOLEAN;

        case NAME_float:
            return TypeName.FLOAT;

        case NAME_double:
            return TypeName.DOUBLE;

        case NAME_char:
            return TypeName.CHAR;

        case NAME_void:
            return TypeName.VOID;
    }
    return ClassName.bestGuess(type);
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:31,代码来源:TypeUtils.java

示例11: bestGuess

private static TypeName bestGuess(String type) {
    switch (type) {
        case "void":
            return TypeName.VOID;
        case "boolean":
            return TypeName.BOOLEAN;
        case "byte":
            return TypeName.BYTE;
        case "char":
            return TypeName.CHAR;
        case "double":
            return TypeName.DOUBLE;
        case "float":
            return TypeName.FLOAT;
        case "int":
            return TypeName.INT;
        case "long":
            return TypeName.LONG;
        case "short":
            return TypeName.SHORT;
        default:
            int left = type.indexOf('<');
            if (left != -1) {
                ClassName typeClassName = ClassName.bestGuess(type.substring(0, left));
                List<TypeName> typeArguments = new ArrayList<>();
                do {
                    typeArguments.add(WildcardTypeName.subtypeOf(Object.class));
                    left = type.indexOf('<', left + 1);
                } while (left != -1);
                return ParameterizedTypeName.get(typeClassName,
                        typeArguments.toArray(new TypeName[typeArguments.size()]));
            }
            return ClassName.bestGuess(type);
    }
}
 
开发者ID:qq542391099,项目名称:butterknife-parent,代码行数:35,代码来源:BindingSet.java

示例12: getIdType

@Nonnull
private TypeName getIdType()
{
  return null == _componentId ?
         TypeName.LONG :
         TypeName.get( _componentId.getReturnType() );
}
 
开发者ID:arez,项目名称:arez,代码行数:7,代码来源:ComponentDescriptor.java

示例13: getTypeName

@Override
public TypeName getTypeName() {
    return (isPrimitive ? TypeName.LONG : ClassName.get(Long.class));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:LongFieldType.java


注:本文中的com.squareup.javapoet.TypeName.LONG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。