本文整理汇总了Java中io.vertx.codegen.type.ClassKind类的典型用法代码示例。如果您正苦于以下问题:Java ClassKind类的具体用法?Java ClassKind怎么用?Java ClassKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassKind类属于io.vertx.codegen.type包,在下文中一共展示了ClassKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveTypeLink
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
public String resolveTypeLink(TypeElement elt, Coordinate coordinate, boolean toObject) {
TypeInfo type;
try {
type = factory.create(elt.asType()).getRaw();
} catch (Exception e) {
System.out.println("Could not resolve doc link for type " + elt.getQualifiedName());
return null;
}
if (type.getKind() == ClassKind.API || (type.getKind() == ClassKind.ENUM && ((EnumTypeInfo) type).isGen()) || type.getKind() == ClassKind.DATA_OBJECT) {
ClassTypeInfo classType = (ClassTypeInfo) type;
String moduleName = classType.getModuleName();
if (moduleName.equals("vertx")) {
moduleName = "vertx-core";
}
String s = "../../ceylondoc/" + moduleName + "/" + classType.getPackageName().substring(classType.getModule().getPackageName().length()).replace('.', '/') + "/";
if (toObject) {
return s + TypeNameTranslator.composite("ceylon").translate(classType.getModule(), classType.getSimpleName()) + ".object.html";
} else {
return s + classType.getSimpleName() + ".type.html";
}
}
return null;
}
示例2: testMethodWithOverloadedNullableParam
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testMethodWithOverloadedNullableParam() throws Exception {
generateClass(model -> {
List<MethodInfo> methods = model.getMethods();
assertEquals(2, methods.size());
MethodInfo mi1 = methods.get(0);
checkMethod(mi1, "method", 2, "void", MethodKind.OTHER);
assertEquals(ClassKind.STRING, mi1.getParams().get(0).getType().getKind());
checkParam(mi1.getParams().get(0), "s", String.class);
assertTrue(mi1.getParams().get(0).isNullable());
checkParam(mi1.getParams().get(1), "i", Integer.class);
assertFalse(mi1.getParams().get(1).isNullable());
MethodInfo mi2 = methods.get(1);
checkMethod(mi2, "method", 2, "void", MethodKind.OTHER);
checkParam(mi2.getParams().get(0), "i", Integer.class);
assertFalse(mi2.getParams().get(0).isNullable());
checkParam(mi2.getParams().get(1), "s", String.class);
assertTrue(mi2.getParams().get(1).isNullable());
}, MethodWithOverloadedNullableParam.class);
}
示例3: testAmbiguousMethods1
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testAmbiguousMethods1() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.JSON_ARRAY, JsonArray.class.getName()));
params1.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, List.class.getName()));
params2.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethods(meths);
}
示例4: testAmbiguousMethods
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
private void testAmbiguousMethods(ClassKind kind1, String typeName1, ClassKind kind2, String typeName2) throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", kind1, typeName1));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", kind2, typeName2));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethods(meths);
}
示例5: testMethodsOK1
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testMethodsOK1() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.JSON_ARRAY, JsonArray.class.getName()));
params1.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.JSON_OBJECT, List.class.getName()));
params2.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethodsOK(meths);
}
示例6: testMethodsOKDifferentPositions
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testMethodsOKDifferentPositions() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
// These would clash if it wasn't for params in different positions
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.STRING, String.class.getName()));
params1.add(new SimpleParam("arg1", ClassKind.JSON_ARRAY, JsonArray.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, List.class.getName()));
params2.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethodsOK(meths);
}
示例7: testMethodsOKDifferentNumbersOfParams
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testMethodsOKDifferentNumbersOfParams() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
// These would clash if it wasn't for different numbers of params
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.JSON_ARRAY, JsonArray.class.getName()));
params1.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
params1.add(new SimpleParam("arg2", ClassKind.PRIMITIVE, "long"));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, List.class.getName()));
params2.add(new SimpleParam("arg1", ClassKind.STRING, String.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethodsOK(meths);
}
示例8: testNullableNotAmbiguous
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testNullableNotAmbiguous() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.STRING, true, JsonArray.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, false, List.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethodsOK(meths);
}
示例9: testNullableDifferentPositionsNotAmbiguous
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testNullableDifferentPositionsNotAmbiguous() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.STRING, true, JsonArray.class.getName()));
params1.add(new SimpleParam("arg1", ClassKind.LIST, false, List.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, false, List.class.getName()));
params2.add(new SimpleParam("arg1", ClassKind.STRING, true, String.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethodsOK(meths);
}
示例10: testNullableAmbiguous
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testNullableAmbiguous() throws Exception {
List<SimpleMethod> meths = new ArrayList<>();
List<SimpleParam> params1 = new ArrayList<>();
params1.add(new SimpleParam("arg0", ClassKind.STRING, true, JsonArray.class.getName()));
SimpleMethod meth1 = new SimpleMethod("meth1", params1);
meths.add(meth1);
List<SimpleParam> params2 = new ArrayList<>();
params2.add(new SimpleParam("arg0", ClassKind.LIST, true, List.class.getName()));
SimpleMethod meth2 = new SimpleMethod("meth1", params2);
meths.add(meth2);
testAmbiguousMethods(meths);
}
示例11: testClass
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testClass() throws Exception {
doTest(OtherHolder.class, map -> {
assertClass(map.get("classType"), "java.util.Locale", ClassKind.OTHER);
assertClass(map.get("interfaceType"), "java.lang.Runnable", ClassKind.OTHER);
assertClass(map.get("genericInterface"), "java.util.concurrent.Callable", ClassKind.OTHER);
assertClass(assertParameterized(map.get("interfaceParameterizedByInterface"), "java.util.concurrent.Callable<java.lang.Runnable>", ClassKind.OTHER).getArg(0), "java.lang.Runnable", ClassKind.OTHER);
assertClass(assertParameterized(map.get("interfaceParameterizedByClass"), "java.util.concurrent.Callable<java.util.Locale>", ClassKind.OTHER).getArg(0), "java.util.Locale", ClassKind.OTHER);
assertTypeVariable(assertParameterized(map.get("interfaceParameterizedByClassTypeParam"), "java.util.concurrent.Callable<ClassTypeParam>", ClassKind.OTHER).getArg(0), "ClassTypeParam");
assertTypeVariable(assertParameterized(map.get("interfaceParameterizedByMethodTypeParam"), "java.util.concurrent.Callable<MethodTypeParam>", ClassKind.OTHER).getArg(0), "MethodTypeParam");
assertClass(assertParameterized(map.get("classParameterizedByInterface"), "java.util.Vector<java.lang.Runnable>", ClassKind.OTHER).getArg(0), "java.lang.Runnable", ClassKind.OTHER);
assertClass(assertParameterized(map.get("classParameterizedByClass"), "java.util.Vector<java.util.Locale>", ClassKind.OTHER).getArg(0), "java.util.Locale", ClassKind.OTHER);
assertTypeVariable(assertParameterized(map.get("classParameterizedByClassTypeParam"), "java.util.Vector<ClassTypeParam>", ClassKind.OTHER).getArg(0), "ClassTypeParam");
assertTypeVariable(assertParameterized(map.get("classParameterizedByMethodTypeParam"), "java.util.Vector<MethodTypeParam>", ClassKind.OTHER).getArg(0), "MethodTypeParam");
});
}
示例12: testBasic
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Test
public void testBasic() throws Exception {
doTest(BasicHolder.class, map -> {
assertPrimitive(map.get("booleanType"), "boolean");
assertPrimitive(map.get("byteType"), "byte");
assertPrimitive(map.get("shortType"), "short");
assertPrimitive(map.get("intType"), "int");
assertPrimitive(map.get("longType"), "long");
assertPrimitive(map.get("floatType"), "float");
assertPrimitive(map.get("doubleType"), "double");
assertPrimitive(map.get("charType"), "char");
assertClass(map.get("BooleanType"), "java.lang.Boolean", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("ShortType"), "java.lang.Short", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("IntegerType"), "java.lang.Integer", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("LongType"), "java.lang.Long", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("FloatType"), "java.lang.Float", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("DoubleType"), "java.lang.Double", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("CharacterType"), "java.lang.Character", ClassKind.BOXED_PRIMITIVE);
assertClass(map.get("StringType"), "java.lang.String", ClassKind.STRING);
});
}
示例13: renderAsyncResultSucceeded
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Override
public void renderAsyncResultSucceeded(TypeInfo resultType, String name) {
if (resultType.getKind() == ClassKind.VOID) {
append("!exists ").append(name);
} else {
append("is ").append(resultType.getSimpleName()).append(" ").append(name);
}
}
示例14: resolveLabel
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Override
public String resolveLabel(Element elt, String defaultLabel) {
if (elt.getKind() == ElementKind.METHOD) {
TypeInfo type = factory.create(elt.getEnclosingElement().asType());
if (type.getKind() == ClassKind.DATA_OBJECT) {
String name = elt.getSimpleName().toString();
if (name.startsWith("set") && name.length() > 3 && Character.isUpperCase(name.charAt(3))) {
name = java.beans.Introspector.decapitalize(name.substring(3));
}
return name;
}
}
return defaultLabel;
}
示例15: as
import io.vertx.codegen.type.ClassKind; //导入依赖的package包/类
@Override
public ExpressionModel as(TypeInfo type) {
if (type.getKind() != ClassKind.JSON_ARRAY) {
throw new UnsupportedOperationException();
}
return this;
}