Ejemplo n.º 1
0
 public ArrayType(JavaTypeDefinition indexedType)
     : base(JavaTypeDefinition.NamingspaceItem.Root, BuildCanonicalName(indexedType))
 {
     if (null == indexedType) { throw new ArgumentNullException(); }
     _indexedType = indexedType;
     JavaTypeDefinition.NamingspaceItem.Root.Register(this);
     return;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /// <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;
 }