本文整理汇总了Java中org.eclipse.jdt.core.dom.PrimitiveType.LONG属性的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveType.LONG属性的具体用法?Java PrimitiveType.LONG怎么用?Java PrimitiveType.LONG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.dom.PrimitiveType
的用法示例。
在下文中一共展示了PrimitiveType.LONG属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrimitiveTypeCode
private PrimitiveType.Code getPrimitiveTypeCode(String type) {
PrimitiveType.Code code = PrimitiveType.toCode(type);
if (code != null) {
return code;
}
if (fEnclosingElement != null
&& JavaModelUtil.is50OrHigher(fEnclosingElement.getJavaProject())) {
if (code == PrimitiveType.SHORT) {
if ("java.lang.Short".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.INT) {
if ("java.lang.Integer".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.LONG) {
if ("java.lang.Long".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.FLOAT) {
if ("java.lang.Float".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.DOUBLE) {
if ("java.lang.Double".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.CHAR) {
if ("java.lang.Character".equals(type)) { // $NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.BYTE) {
if ("java.lang.Byte".equals(type)) { // $NON-NLS-1$
return code;
}
}
}
return null;
}
示例2: getPrimitiveTypeCode
private PrimitiveType.Code getPrimitiveTypeCode(String type) {
PrimitiveType.Code code= PrimitiveType.toCode(type);
if (code != null) {
return code;
}
if (fEnclosingElement != null && JavaModelUtil.is50OrHigher(fEnclosingElement.getJavaProject())) {
if (code == PrimitiveType.SHORT) {
if ("java.lang.Short".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.INT) {
if ("java.lang.Integer".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.LONG) {
if ("java.lang.Long".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.FLOAT) {
if ("java.lang.Float".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.DOUBLE) {
if ("java.lang.Double".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.CHAR) {
if ("java.lang.Character".equals(type)) { //$NON-NLS-1$
return code;
}
} else if (code == PrimitiveType.BYTE) {
if ("java.lang.Byte".equals(type)) { //$NON-NLS-1$
return code;
}
}
}
return null;
}
示例3: getExecMethodName
private SimpleName getExecMethodName(MethodDeclaration md) {
Type type = md.getReturnType2();
String name = "execPython";
if (type.isPrimitiveType()) {
PrimitiveType ptype = (PrimitiveType)type;
PrimitiveType.Code ptcode = ptype.getPrimitiveTypeCode();
if (ptcode == PrimitiveType.BYTE) {
name += "Byte";
}
else if (ptcode == PrimitiveType.SHORT) {
name += "Short";
}
else if (ptcode == PrimitiveType.CHAR) {
name += "Char";
}
else if (ptcode == PrimitiveType.INT) {
name += "Int";
}
else if (ptcode == PrimitiveType.LONG) {
name += "Long";
}
else if (ptcode == PrimitiveType.FLOAT) {
name += "Float";
}
else if (ptcode == PrimitiveType.DOUBLE) {
name += "Double";
}
else if (ptcode == PrimitiveType.BOOLEAN) {
name += "Bool";
}
else if (ptcode == PrimitiveType.VOID) {
name += "Void";
}
}
return ast.newSimpleName(name);
}
示例4: setExecArguments
private void setExecArguments(MethodDeclaration md, MethodInvocation mi) {
for (int i = 0; i < md.parameters().size(); i++) {
SingleVariableDeclaration svd = (SingleVariableDeclaration)md.parameters().get(i);
Type type = svd.getType();
if (!type.isPrimitiveType()) {
// arg -> arg
mi.arguments().add((Name)ASTNode.copySubtree(ast, svd.getName()));
}
else {
// arg -> DataConvertor.from*(arg)
Name dataConvertor = ast.newSimpleName("DataConvertor");
MethodInvocation mi2 = ast.newMethodInvocation();
mi2.setExpression(dataConvertor);
PrimitiveType ptype = (PrimitiveType)type;
PrimitiveType.Code ptcode = ptype.getPrimitiveTypeCode();
String methName = "from";
if (ptcode == PrimitiveType.BYTE) {
methName += "Byte";
}
else if (ptcode == PrimitiveType.SHORT) {
methName += "Short";
}
else if (ptcode == PrimitiveType.CHAR) {
methName += "Char";
}
else if (ptcode == PrimitiveType.INT) {
methName += "Int";
}
else if (ptcode == PrimitiveType.LONG) {
methName += "Long";
}
else if (ptcode == PrimitiveType.FLOAT) {
methName += "Float";
}
else if (ptcode == PrimitiveType.DOUBLE) {
methName += "Double";
}
else if (ptcode == PrimitiveType.BOOLEAN) {
methName += "Bool";
}
mi2.setName(ast.newSimpleName(methName));
mi2.arguments().add(ASTNode.copySubtree(ast, svd.getName()));
mi.arguments().add(mi2);
}
}
}