예제 #1
0
        public static string GetCSharpType(this ApiMethodParameter parameter)
        {
            // Handle primitive types
            switch (parameter.Type)
            {
            case ApiObjectType.Integer:
                return("int?");

            case ApiObjectType.Boolean:
                return("bool?");

            case ApiObjectType.Number:
                return("double?");

            case ApiObjectType.Multiple:     // TODO: Think about this type
            case ApiObjectType.String:
                return("string");

            case ApiObjectType.Array:

                if (parameter.Items != null)
                {
                    var genericType = string.IsNullOrWhiteSpace(parameter.Items.Name) ?
                                      parameter.Items.GetCSharpType(false) :
                                      parameter.Items.Name.ToBeautifiedName();

                    return($"IEnumerable<{genericType}>");
                }

                return("IEnumerable<object>");    // TODO: Maybe throw an exception here later...?
            }

            return("object"); // TODO: Maybe throw an exception here later...?
        }
예제 #2
0
        protected virtual void Process(HierarchyMethod parent, ApiMethodParameter parameter)
        {
            var hierarchyMethodParameter = CreateHierarchyElementInternal <HierarchyMethodParameter> (parent);

            hierarchyMethodParameter.Init(parameter);
            parent.AddMember(hierarchyMethodParameter);
        }
예제 #3
0
        public override void Init(ApiElement apiElement)
        {
            base.Init(apiElement);

            apiMethodParameter = EnsureApiElementType <ApiMethodParameter> (apiElement);
            JniType            = apiMethodParameter.JniType;
        }
예제 #4
0
        public static string ResolveType(ApiMethodParameter parameter)
        {
            if (parameter.Type == ApiObjectType.Array)
            {
                return($"IEnumerable<{MapType(parameter.Items.Type) ?? "string"}>");
            }

            if (parameter.Type == ApiObjectType.String && JsonArrayParameters.Contains(parameter.Name))
            {
                return("JsonArray");
            }

            return(ResolveDate(parameter.Name, MapType(parameter.Type), parameter.Description));
        }
예제 #5
0
 public static bool IsArray(this ApiMethodParameter parameter) => parameter.Type == ApiObjectType.Array && parameter.Items != null;
예제 #6
0
 public static bool IsEnum(this ApiMethodParameter parameter) => EnumObjectTypes.Contains(parameter.Type) && parameter.Enum != null;