public override void Init(ApiElement apiElement) { base.Init(apiElement); apiImplements = EnsureApiElementType <ApiImplements> (apiElement); JniType = apiImplements.JniType; }
public virtual void Init(ApiElement apiElement) { if (apiElement == null) { throw new ArgumentNullException(nameof(apiElement)); } this.apiElement = apiElement; IsBoundAPI = true; Name = apiElement.Name; FullName = GenerateFullJavaName(); ManagedName = apiElement.ManagedName; FullManagedName = null; JniSignature = apiElement.JniSignature; DocumentPath = apiElement.DocumentPath; DeprecatedMessage = apiElement.DeprecatedMessage; IsDeprecated = apiElement.IsDeprecated; DeprecatedSinceAPI = apiElement.DeprecatedSinceAPI; AvailableSinceAPI = apiElement.AvailableSinceAPI; AvailableUntilAPI = apiElement.AvailableUntilAPI; SourceLine = apiElement.SourceLine; SourceColumn = apiElement.SourceColumn; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiMethodParameter = EnsureApiElementType <ApiMethodParameter> (apiElement); JniType = apiMethodParameter.JniType; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiException = EnsureApiElementType <ApiException> (apiElement); Type = apiException.Type; TypeGenericAware = apiException.TypeGenericAware; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiTypeMember = EnsureApiElementType <ApiTypeMember> (apiElement); Final = apiTypeMember.Final; Static = apiTypeMember.Static; Visibility = apiTypeMember.Visibility; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiField = EnsureApiElementType <ApiField> (apiElement); Transient = apiField.Transient; Type = apiField.Type; TypeGenericAware = apiField.TypeGenericAware; Value = apiField.Value; Volatile = apiField.Volatile; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiTypeParameter = EnsureApiElementType <ApiTypeParameter> (apiElement); // Unused for now // // ClassBound = apiTypeParameter.ClassBound; // JniClassBound = apiTypeParameter.JniClassBound; // InterfaceBounds = apiTypeParameter.InterfaceBounds; // JniInterfaceBounds = apiTypeParameter.JniInterfaceBounds; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiClass = ApiElement as ApiClass; if (apiClass == null) { return; } Extends = apiClass.Extends; ExtendsGenericAware = apiClass.ExtendsGenericAware; Obfuscated = apiClass.Obfuscated; }
public static bool IsInInternalNamespace(ApiElement e) { var type = e as TypeDescriptor; if (type == null) { return(false); } var segments = type.Name.Split('.'); // Skip the last segment as is the type name. return(segments.Take(segments.Length - 1).Any(s => s.Equals("Internal"))); }
protected TApiElement EnsureApiElementType <TApiElement> (ApiElement apiElement) where TApiElement : ApiElement { if (apiElement == null) { throw new ArgumentNullException(nameof(apiElement)); } TApiElement ret = apiElement as TApiElement; if (ret == null) { throw new InvalidOperationException($"Expected API element of type '{typeof (TApiElement).FullName}' but got '{apiElement.GetType ().FullName}' instead"); } return(ret); }
void AddLocationComment(ApiElement element, HierarchyElement hierarchyElement) { if (String.IsNullOrEmpty(element.DocumentPath) || element.SourceLine < 0) { return; } var sb = new StringBuilder(); sb.Append(element.DocumentPath); if (element.SourceColumn > 0) { sb.Append($" [{element.SourceLine}:{element.SourceColumn}]"); } else { sb.Append($":{element.SourceLine}"); } hierarchyElement.AddComment(sb.ToString()); }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiMethod = EnsureApiElementType <ApiMethod> (apiElement); Abstract = apiMethod.Abstract; ArgsType = apiMethod.ArgsType; EnumReturn = apiMethod.EnumReturn; EventName = apiMethod.EventName; GenerateAsyncWrapper = apiMethod.GenerateAsyncWrapper; GenerateDispatchingSetter = apiMethod.GenerateDispatchingSetter; ManagedReturn = apiMethod.ManagedReturn; Native = apiMethod.Native; PropertyName = apiMethod.PropertyName; Return = apiMethod.Return; JniReturn = apiMethod.JniReturn; Synchronized = apiMethod.Synchronized; IsBridge = apiMethod.IsBridge; IsSynthetic = apiMethod.IsSynthetic; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiType = EnsureApiElementType <ApiType>(apiElement); if (apiElement.ChildElements != null) { foreach (ApiImplements ai in apiElement.ChildElements.OfType <ApiImplements> ().Where(o => o != null)) { string name = ai.NameGenericAware?.Trim(); // if (String.IsNullOrEmpty (name)) name = ai.Name; AddImplements(name); } } Abstract = apiType.Abstract; Static = apiType.Static; Visibility = apiType.Visibility; Final = apiType.Final; }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiEnum = EnsureApiElementType <ApiEnum> (apiElement); // Enums are special - their name attribute is set to the full managed name int lastDot = apiElement.Name.LastIndexOf('.'); if (lastDot < 0) { return; } if (lastDot == 0) { throw new InvalidOperationException($"Type name ({apiElement.Name}) must not start with a dot"); } FullName = Name; Name = apiElement.Name.Substring(lastDot + 1); }
/// <summary> /// Gets the full qualified response file path. /// </summary> /// <param name="api">ApiElement instance.</param> /// <returns>Returns the full qualified response file path.</returns> public string GetApiReponseFullPath(ApiElement api) { var src = api.Src; if (!this.HasValidJsonFileExtension(src)) { src = this.GetDefaultApiResponseFilePath(api); } string fullpath; if (HostingEnvironment.IsHosted) { fullpath = HostingEnvironment.MapPath(src); return(fullpath); } var assembly = Assembly.GetExecutingAssembly(); var directory = Path.GetDirectoryName(assembly.Location); fullpath = (directory + src.Replace("~/", "/")).Replace("/", "\\"); if (File.Exists(fullpath)) { return(fullpath); } var codebase = String.Join("/", assembly.CodeBase .Replace("file:///", "") .Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries) .TakeWhile(p => !p.ToLower().EndsWith(".dll"))); fullpath = (codebase + src.Replace("~/", "/")).Replace("/", "\\"); if (File.Exists(fullpath)) { return(fullpath); } return(null); }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiNameSpace = EnsureApiElementType <ApiNameSpace> (apiElement); JniName = apiNameSpace.JniName; }
/// <summary> /// Gets the default response file path. /// </summary> /// <param name="api">ApiElement instance.</param> /// <returns>Returns the default response file path.</returns> public string GetDefaultApiResponseFilePath(ApiElement api) { return(this.GetDefaultApiResponseFilePath(api.Method, api.Url)); }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiTypeParameterGenericConstraint = EnsureApiElementType <ApiTypeParameterGenericConstraint> (apiElement); }