public ArrayType(JavaTypeDefinition indexedType) : base(JavaTypeDefinition.NamingspaceItem.Root, BuildCanonicalName(indexedType)) { if (null == indexedType) { throw new ArgumentNullException(); } _indexedType = indexedType; JavaTypeDefinition.NamingspaceItem.Root.Register(this); return; }
internal void Register(JavaTypeDefinition definition) { if (null == definition) { throw new ArgumentNullException(); } if (definition.IsArray) { if (!object.ReferenceEquals(Root, this)) { throw new InvalidOperationException(); } if (!(definition is ArrayType)) { throw new ArgumentException(); } this._arraysByIndexedItem.Add(definition.IndexedType, (ArrayType)definition); } if (null == _typesPerName) { _typesPerName = new Dictionary<string, JavaTypeDefinition>(); } if (_typesPerName.ContainsKey(definition.Name)) { throw new InvalidOperationException(); } if (!object.ReferenceEquals(this, definition.Namespace)) { throw new InvalidOperationException(); } _typesPerName.Add(definition.Name, definition); return; }
public ArrayType TryGetArrayOf(JavaTypeDefinition item) { if (null == item) { throw new ArgumentNullException(); } if (!object.ReferenceEquals(this, Root)) { throw new InvalidOperationException(); } if (null == _arraysByIndexedItem) { return null; } ArrayType result; return _arraysByIndexedItem.TryGetValue(item, out result) ? result : null; }
/// <summary></summary> /// <param name="indexed"></param> /// <remarks>This constructor is for <see cref="ArrayType"/> use only.</remarks> protected JavaTypeDefinition(JavaTypeDefinition indexed) { if (null == indexed) { throw new ArgumentNullException(); } NamingspaceItem.Root.Register(this); return; }