public void accept(TypeVisitor typeVisitor) { delegate.accept(typeVisitor); }
@Nonnull @Override public JClass generateFieldType( @Nonnull FieldDeclarationInfo fieldInfo ) { return codeGenerator.ref( fieldInfo.getType().toString() ); }
public void accept(TypeVisitor typeVisitor) { delegate.accept(typeVisitor); }
/** * Returns whether the given field info is a build in type * * @param fieldInfo the field info * @return true if the field is of the build in type, false otherwise */ public static boolean isBuildInType( @Nonnull FieldTypeInformation fieldInfo ) { return ParseExpressionFactory.getSupportedTypeNames().contains( fieldInfo.getType().toString() ); }
/** * Adds any referenced type definitions for the specified type mirror. * * @param type The type mirror. */ protected void addReferencedTypeDefinitions(TypeMirror type) { type.accept(new ReferencedXmlTypeDefinitionVisitor()); }
@Nonnull @Override public JClass generateFieldType( @Nonnull FieldDeclarationInfo fieldInfo ) { return codeGenerator.ref( TypeUtils.getErasure( fieldInfo.getType() ).toString() ); }
/** * Adds any referenced type definitions for the specified type mirror. * * @param type The type mirror. */ protected void addReferencedJsonTypeDefinitions(TypeMirror type) { type.accept(new ReferencedJsonTypeDefinitionVisitor()); }
@Override @Nonnull public Expressions createReadFromDeserializeFromExpression( @Nonnull AbstractGenerator<?> generator, @Nonnull JDefinedClass serializerClass, @Nonnull JExpression deserializeFrom, JVar wrapper, @Nonnull JVar formatVersion, @Nonnull FieldDeclarationInfo fieldInfo ) { JClass collectionParamType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() ); JInvocation nextTagExpression = createNextTagInvocation( serializerClass, deserializeFrom, fieldInfo ); JInvocation expression = JExpr.invoke( METHOD_NAME_DESERIALIZE_COLLECTION ).arg( deserializeFrom ).arg( JExpr.dotclass( collectionParamType ) ).arg( formatVersion ); return new Expressions( expression, nextTagExpression ); }
public void visitArrayType(ArrayType arrayType) { if (isInArray) { this.xmlType = null; this.errorMessage = "No support yet for multidimensional arrays."; return; } arrayType.getComponentType().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the array component type: " + this.errorMessage; } }
@Nonnull @Override public Expressions createReadFromDeserializeFromExpression( @Nonnull AbstractGenerator<?> generator, @Nonnull JDefinedClass serializerClass, @Nonnull JExpression deserializeFrom, JVar wrapper, @Nonnull JVar formatVersion, @Nonnull FieldDeclarationInfo fieldInfo ) { JInvocation nextTagExpression = createNextTagInvocation( serializerClass, deserializeFrom, fieldInfo ); JClass type = codeGenerator.ref( TypeUtils.getErasure( fieldInfo.getType() ).toString() ); JInvocation expression = JExpr.invoke( METHOD_NAME_DESERIALIZE ).arg( JExpr.dotclass( type ) ).arg( formatVersion ).arg( deserializeFrom ); return new Expressions( expression, nextTagExpression ); }
@Override public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); fqn[0] += "[]"; } });
@Nonnull @Override public JClass generateFieldType( @Nonnull FieldDeclarationInfo fieldInfo ) { JClass collectionType = codeGenerator.ref( fieldInfo.getCollectionParam().toString() ); JClass list = codeGenerator.getModel().ref( List.class ); return list.narrow( collectionType.wildcard() ); }
public void visitArrayType(ArrayType arrayType) { if (isInArray) { this.xmlType = null; this.errorMessage = "No support yet for multidimensional arrays."; return; } arrayType.getComponentType().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the array component type: " + this.errorMessage; } }
@Nonnull @Override public JStatement createAddToSerializeToExpression( @Nonnull AbstractGenerator<?> generator, @Nonnull JDefinedClass serializerClass, @Nonnull JExpression serializeTo, @Nonnull FieldDeclarationInfo fieldInfo, @Nonnull JVar object, JVar formatVersion ) { //Add serializer to constructor generator.addDelegatingSerializerToConstructor( serializerClass, codeGenerator.ref( TypeUtils.getErasure( fieldInfo.getType() ).toString() ) ); JFieldVar constant = getConstant( serializerClass, fieldInfo ); JExpression getterInvocation = codeGenerator.createGetterInvocation( object, fieldInfo ); return JExpr.invoke( METHOD_NAME_SERIALIZE ) .arg( getterInvocation ) .arg( JExpr.dotclass( codeGenerator.ref( TypeUtils.getErasure( fieldInfo.getType() ).toString() ) ) ) .arg( createAddElementExpression( serializeTo, constant ) ) .arg( formatVersion ) ; }
public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); }
@Override @Nonnull public JInvocation createAddToSerializeToExpression( @Nonnull AbstractGenerator<?> generator, @Nonnull JDefinedClass serializerClass, @Nonnull JExpression serializeTo, @Nonnull FieldDeclarationInfo fieldInfo, @Nonnull JVar object, JVar formatVersion ) { generator.addDelegatingSerializerToConstructor( serializerClass, codeGenerator.ref( TypeUtils.getErasure( fieldInfo.getCollectionParam() ).toString() ) ); JFieldVar constant = getConstant( serializerClass, fieldInfo ); JInvocation getterInvocation = codeGenerator.createGetterInvocation( object, fieldInfo ); return JExpr.invoke( METHOD_NAME_SERIALIZE_COLLECTION ) .arg( getterInvocation ) .arg( JExpr.dotclass( codeGenerator.ref( fieldInfo.getCollectionParam().toString() ) ) ) .arg( constant ) .arg( serializeTo ) .arg( formatVersion ) ; }
public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); }
/** * Decorate a collection fo type mirrors. * * @param typeMirrors The type mirrors to decorate. * @return The collection of decorated type mirrors. */ @SuppressWarnings({"unchecked"}) public static <T extends TypeMirror> Collection<T> decorate(Collection<T> typeMirrors) { if (typeMirrors == null) { return null; } ArrayList<T> mirrors = new ArrayList<T>(typeMirrors.size()); TypeMirrorDecorator decorator = getInstance(); for (T mirror : typeMirrors) { mirror.accept(decorator); mirrors.add((T) decorator.getDecoratedTypeMirror()); } return mirrors; }
public void visitDeclaredType(DeclaredType declaredType) { TypeDeclaration declaration = declaredType.getDeclaration(); if (declaration != null) { String qualifiedName = declaration.getQualifiedName(); if (!qualifiedName.startsWith("java.lang")) { importedTypes.put(qualifiedName, declaration); } } for (TypeMirror type : declaredType.getActualTypeArguments()) { type.accept(this); } }
/** * Decorate a type mirror. * * @param typeMirror The mirror to decorate. * @return The decorated type mirror. */ @SuppressWarnings({"unchecked"}) public static <T extends TypeMirror> T decorate(T typeMirror) { if (typeMirror == null) { return null; } TypeMirrorDecorator decorator = getInstance(); typeMirror.accept(decorator); return (T) decorator.getDecoratedTypeMirror(); }