Java Code Examples for com.squareup.javapoet.TypeName#OBJECT
The following examples show how to use
com.squareup.javapoet.TypeName#OBJECT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodeFactoryGenerator.java From caffeine with Apache License 2.0 | 6 votes |
private TypeSpec makeNodeSpec(String className, boolean isFinal, Set<Feature> features) { TypeName superClass; Set<Feature> parentFeatures; Set<Feature> generateFeatures; if (features.size() == 2) { parentFeatures = ImmutableSet.of(); generateFeatures = features; superClass = TypeName.OBJECT; } else { parentFeatures = ImmutableSet.copyOf(Iterables.limit(features, features.size() - 1)); generateFeatures = ImmutableSet.of(Iterables.getLast(features)); superClass = ParameterizedTypeName.get(ClassName.get(PACKAGE_NAME, encode(Feature.makeClassName(parentFeatures))), kTypeVar, vTypeVar); } NodeContext context = new NodeContext(superClass, className, isFinal, parentFeatures, generateFeatures); for (NodeRule rule : rules) { rule.accept(context); } return context.nodeSubtype.build(); }
Example 2
Source File: MethodParamModelFactoryTest.java From litho with Apache License 2.0 | 5 votes |
@Before public void ListUp() { mDiffTypeSpecWrappingInt = new TypeSpec.DeclaredTypeSpec( ClassNames.DIFF, ClassNames.DIFF.packageName() + "." + ClassNames.DIFF.simpleName(), () -> new TypeSpec(TypeName.OBJECT), () -> ImmutableList.of(), () -> ImmutableList.of(new TypeSpec(TypeName.INT.box()))); }
Example 3
Source File: JniProcessor.java From cronet with BSD 3-Clause "New" or "Revised" License | 5 votes |
TypeName toTypeName(TypeMirror t, boolean useJni) { if (t.getKind() == TypeKind.ARRAY) { return ArrayTypeName.of(toTypeName(((ArrayType) t).getComponentType(), useJni)); } TypeName typeName = TypeName.get(t); if (useJni && shouldDowncastToObjectForJni(typeName)) { return TypeName.OBJECT; } return typeName; }
Example 4
Source File: ClassNameModel.java From nalu with Apache License 2.0 | 4 votes |
public TypeName getTypeName() { switch (className) { case "void": return TypeName.VOID; case "boolean": return TypeName.BOOLEAN; case "byte": return TypeName.BYTE; case "short": return TypeName.SHORT; case "int": return TypeName.INT; case "long": return TypeName.LONG; case "char": return TypeName.CHAR; case "float": return TypeName.FLOAT; case "double": return TypeName.DOUBLE; case "Object": return TypeName.OBJECT; case "Void": return ClassName.get("java.lang", "Void"); case "Boolean": return ClassName.get("java.lang", "Boolean"); case "Byte": return ClassName.get("java.lang", "Byte"); case "Short": return ClassName.get("java.lang", "Short"); case "Integer": return ClassName.get("java.lang", "Integer"); case "Long": return ClassName.get("java.lang", "Long"); case "Character": return ClassName.get("java.lang", "Character"); case "Float": return ClassName.get("java.lang", "Float"); case "Double": return ClassName.get("java.lang", "Double"); default: return ClassName.get(this.getPackage(), this.getSimpleName()); } }
Example 5
Source File: ClassNameModel.java From nalu with Apache License 2.0 | 4 votes |
public TypeName getTypeName() { switch (className) { case "void": return TypeName.VOID; case "boolean": return TypeName.BOOLEAN; case "byte": return TypeName.BYTE; case "short": return TypeName.SHORT; case "int": return TypeName.INT; case "long": return TypeName.LONG; case "char": return TypeName.CHAR; case "float": return TypeName.FLOAT; case "double": return TypeName.DOUBLE; case "Object": return TypeName.OBJECT; case "Void": return ClassName.get("java.lang", "Void"); case "Boolean": return ClassName.get("java.lang", "Boolean"); case "Byte": return ClassName.get("java.lang", "Byte"); case "Short": return ClassName.get("java.lang", "Short"); case "Integer": return ClassName.get("java.lang", "Integer"); case "Long": return ClassName.get("java.lang", "Long"); case "Character": return ClassName.get("java.lang", "Character"); case "Float": return ClassName.get("java.lang", "Float"); case "Double": return ClassName.get("java.lang", "Double"); default: return ClassName.get(this.getPackage(), this.getSimpleName()); } }
Example 6
Source File: JsonNull.java From json2java4idea with Apache License 2.0 | 4 votes |
@Nonnull @Override public TypeName getType() { return TypeName.OBJECT; }