11using System.Collections.Generic;
21 internal static class FieldDefinitionExtractor
30 public static ExtractedFieldDefinition ExtractFieldDefinition(DefinitionExtractionContext extractionContext, FieldDeclarationSyntax fieldDeclaration)
32 ExtractedFieldDefinition fieldDefinition =
new ExtractedFieldDefinition();
34 fieldDefinition.FieldName = GetFieldName(extractionContext, fieldDeclaration);
35 fieldDefinition.TypeDefinition.TypeName = GetFieldTypeName(extractionContext, fieldDeclaration);
36 fieldDefinition.TypeDefinition.TypeNamespace = extractionContext.GetTypeNamespace(fieldDeclaration.Declaration.Type);
37 fieldDefinition.TypeDefinition.IsAutoSerializable = extractionContext.IsTypeAutoSerializable(fieldDeclaration.Declaration.Type);
38 fieldDefinition.TypeDefinition.ImplementsIMobileObject = extractionContext.DoesTypeImplementIMobileObject(fieldDeclaration.Declaration.Type);
40 return fieldDefinition;
43 #region Private Helper Methods
51 private static string GetFieldName(DefinitionExtractionContext extractionContext, FieldDeclarationSyntax fieldDeclaration)
53 return fieldDeclaration.Declaration.Variables[0].Identifier.ToString();
62 private static string GetFieldTypeName(DefinitionExtractionContext extractionContext, FieldDeclarationSyntax fieldDeclaration)
64 return fieldDeclaration.Declaration.Type.ToString();