public JavaStructureMember(StructureMember member, JavaType type, JavaStructure structure)
            : base(member)
        {
            _member = member;
            _type = type;
            _structure = structure;

            _containedInStructure = member.Parent.Implementation as JavaStructure;
        }
Esempio n. 2
0
        public override object CreateStructureMemberImplementationHelper(StructureMember member)
        {
            if (member.FieldTypeReference is IntrinsicTypeReference)
            {
                IntrinsicTypeReference reference = member.FieldTypeReference as IntrinsicTypeReference;

                return new JavaStructureMember(member, _intrinsics[reference.Type], null);
            }
            else
            {
                DeclarationTypeReference reference = member.FieldTypeReference as DeclarationTypeReference;

                NamespaceName name = reference.Declaration.QualifiedName;
                string codecName = reference.Declaration.Identifier;
                bool isReferenceType = !(reference.Declaration is Enumeration);

                if (reference.Declaration.Implementation is JavaStructure)
                {
                    JavaStructure structure = (JavaStructure)reference.Declaration.Implementation;

                    name = structure.ReferenceTypeName;
                    codecName = structure.Identifier;
                    isReferenceType = structure.IsReferenceType;
                }

                bool isInProtocolNamespace =
                    name.ContainingName.Equals(member.Parent.Parent.Name);

                JavaType type;

                if (isInProtocolNamespace)
                {
                    type = new JavaType(name.UnqualifiedName, null);
                }
                else
                {
                    type = new JavaType(name.ToString(), null);
                }

                return new JavaStructureMember(member, type, reference.Declaration.Implementation as JavaStructure);
            }
        }