コード例 #1
0
        /// <summary>
        /// Adds a type to the collection.  Note declaring classes must be added before nested classes.
        /// </summary>
        /// <returns>True if type was added to collection. False if type could not be added because its declaring type was missing.</returns>
        public bool AddType(JavaTypeModel type)
        {
            var nested_name = type.NestedName;

            // Not a nested type
            if (!nested_name.Contains('.'))
            {
                types [type.FullName] = type;

                types_flattened [type.FullName] = type;

                return(true);
            }

            var full_name = type.FullName.ChompLast('.');

            // Nested type, find declaring model to put it in
            if (types_flattened.TryGetValue(full_name, out var declaring))
            {
                if (!declaring.NestedTypes.Contains(type))
                {
                    declaring.NestedTypes.Add(type);
                }

                type.DeclaringType = declaring;
                types_flattened [type.FullName] = type;

                return(true);
            }

            // Could not find declaring type to nest child type in
            return(false);
        }
コード例 #2
0
 public JavaMemberModel(string name, bool isStatic, bool isFinal, string visibility, JavaTypeModel declaringType, string deprecated, string jniSignature)
 {
     Name          = name;
     IsStatic      = isStatic;
     IsFinal       = isFinal;
     Visibility    = visibility;
     DeclaringType = declaringType;
     Deprecated    = deprecated;
     JniSignature  = jniSignature;
 }
コード例 #3
0
        // This is a little trickier than we may initially think, because nested classes
        // will also need to be removed from TypesFlattened (recursively). Note this only
        // removes the type from this collection, it does not remove a nested type from
        // its declaring type model. Returns true if type(s) were removed.
        public bool RemoveType(JavaTypeModel type)
        {
            var removed = false;

            // Remove all nested types
            foreach (var nested in type.NestedTypes)
            {
                removed |= RemoveType(nested);
            }

            // Remove ourselves
            removed |= types_flattened.Remove(type.FullName);
            removed |= types.Remove(type.FullName);

            return(removed);
        }
コード例 #4
0
        /// <summary>
        /// Adds a reference type to the collection.
        /// </summary>
        public void AddReferencedType(JavaTypeModel type)
        {
            type.IsReferencedOnly = true;

            referenced_types_flattened [type.FullName] = type;
        }
コード例 #5
0
 public JavaTypeReference(JavaTypeModel referencedType, IList <JavaTypeReference>?typeParameters, string?arrayPart)
 {
     ReferencedType = referencedType ?? throw new ArgumentNullException(nameof(referencedType));
     TypeParameters = typeParameters;
     ArrayPart      = arrayPart;
 }
コード例 #6
0
 public JavaConstructorModel(string javaName, string javaVisibility, bool javaStatic, JavaTypeModel javaDeclaringType, string deprecated, string jniSignature, bool isSynthetic, bool isBridge)
     : base(javaName, javaVisibility, false, false, javaStatic, "void", javaDeclaringType, deprecated, jniSignature, isSynthetic, isBridge, string.Empty, false, false, false)
 {
 }
コード例 #7
0
 public JavaTypeParameters(JavaTypeModel declaringType) => DeclaringType       = declaringType;
コード例 #8
0
 public JavaFieldModel(string name, string visibility, string type, string typeGeneric, string?value, bool isStatic, JavaTypeModel declaringType, bool isFinal, string deprecated, string jniSignature, bool isTransient, bool isVolatile, bool isNotNull)
     : base(name, isStatic, isFinal, visibility, declaringType, deprecated, jniSignature)
 {
     Type        = type;
     TypeGeneric = typeGeneric;
     Value       = value;
     IsTransient = isTransient;
     IsVolatile  = isVolatile;
     IsNotNull   = isNotNull;
 }
コード例 #9
0
        public JavaMethodModel(string javaName, string javaVisibility, bool javaAbstract, bool javaFinal, bool javaStatic, string javaReturn, JavaTypeModel javaDeclaringType, string deprecated, string jniSignature, bool isSynthetic, bool isBridge, string returnJni, bool isNative, bool isSynchronized, bool returnNotNull)
            : base(javaName, javaStatic, javaFinal, javaVisibility, javaDeclaringType, deprecated, jniSignature)
        {
            IsAbstract     = javaAbstract;
            Return         = javaReturn;
            ReturnGeneric  = javaReturn;
            IsBridge       = isBridge;
            IsSynthetic    = isSynthetic;
            ReturnJni      = returnJni;
            IsNative       = isNative;
            IsSynchronized = isSynchronized;
            ReturnNotNull  = returnNotNull;

            TypeParameters = new JavaTypeParameters(this);
        }