コード例 #1
0
ファイル: Extensions.cs プロジェクト: szaboopeeter/autorest
        /// <summary>
        /// Returns true if the <paramref name="type"/> is a DictionaryType with ValueType matching <paramref name="typeToMatch"/>
        /// </summary>
        /// <param name="type"></param>
        /// <param name="typeToMatch"></param>
        /// <returns></returns>
        public static bool IsDictionaryContainingType(this IModelType type, KnownPrimaryType typeToMatch)
        {
            DictionaryType dictionaryType        = type as DictionaryType;
            PrimaryType    dictionaryPrimaryType = dictionaryType?.ValueType as PrimaryType;

            return(dictionaryPrimaryType != null && dictionaryPrimaryType.IsPrimaryType(typeToMatch));
        }
コード例 #2
0
 public PrimaryTypeGo(KnownPrimaryType primaryType) : base(primaryType)
 {
     Name.OnGet += v =>
     {
         return(ImplementationName);
     };
 }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: szaboopeeter/autorest
        /// <summary>
        /// Returns true if the <paramref name="type"/>is a SequenceType matching <paramref name="typeToMatch"/>
        /// </summary>
        /// <param name="type"></param>
        /// <param name="typeToMatch"></param>
        /// <returns></returns>
        public static bool IsSequenceContainingType(this IModelType type, KnownPrimaryType typeToMatch)
        {
            SequenceType sequenceType        = type as SequenceType;
            PrimaryType  sequencePrimaryType = sequenceType?.ElementType as PrimaryType;

            return(sequencePrimaryType != null && sequencePrimaryType.IsPrimaryType(typeToMatch));
        }
コード例 #4
0
ファイル: PrimaryTypeCs.cs プロジェクト: devigned/autorest
 public PrimaryTypeCs(KnownPrimaryType primaryType) : base(primaryType)
 {
     Name.OnGet += v =>
     {
         return ImplementationName;
     };
 }
コード例 #5
0
ファイル: Extensions.cs プロジェクト: vladbarosan/autorest.go
        public static bool PrimaryType(this IModelType type, KnownPrimaryType typeToMatch)
        {
            if (type == null)
            {
                return(false);
            }

            return(type is PrimaryType primaryType && primaryType.KnownPrimaryType == typeToMatch);
        }
コード例 #6
0
ファイル: Extensions.cs プロジェクト: tjprescott/autorest
        public static bool IsPrimaryType(this IType type, KnownPrimaryType typeToMatch)
        {
            if (type == null)
            {
                return(false);
            }

            PrimaryType primaryType = type as PrimaryType;

            return(primaryType != null && primaryType.Type == typeToMatch);
        }
コード例 #7
0
ファイル: Extensions.cs プロジェクト: szaboopeeter/autorest
        /// <summary>
        /// Returns true if the <paramref name="type"/> is a PrimaryType with KnownPrimaryType matching <paramref name="typeToMatch"/>
        /// or a DictionaryType with ValueType matching <paramref name="typeToMatch"/> or a SequenceType matching <paramref name="typeToMatch"/>
        /// </summary>
        /// <param name="type"></param>
        /// <param name="typeToMatch"></param>
        /// <returns></returns>
        public static bool IsOrContainsPrimaryType(this IModelType type, KnownPrimaryType typeToMatch)
        {
            if (type == null)
            {
                return(false);
            }

            if (type.IsPrimaryType(typeToMatch) ||
                type.IsDictionaryContainingType(typeToMatch) ||
                type.IsSequenceContainingType(typeToMatch))
            {
                return(true);
            }
            return(false);
        }
コード例 #8
0
 /// <summary>
 ///     Initializes a new instance of PrimaryType class from a known type.
 /// </summary>
 protected PrimaryType(KnownPrimaryType knownPrimaryType)
 {
     KnownPrimaryType = knownPrimaryType;
     Name             = KnownPrimaryType.ToString();
 }
コード例 #9
0
ファイル: PrimaryTypeCsa.cs プロジェクト: devigned/autorest
 protected PrimaryTypeCsa(KnownPrimaryType primaryType) : base(primaryType)
 {
 }
コード例 #10
0
ファイル: PrimaryTypeModel.cs プロジェクト: jkonecki/autorest
 public PrimaryTypeModel(KnownPrimaryType knownPrimaryType)
     : this (new PrimaryType(knownPrimaryType))
 {
 }
コード例 #11
0
ファイル: Extensions.cs プロジェクト: szaboopeeter/autorest
 /// <summary>
 /// Returns true if the type is a PrimaryType with KnownPrimaryType matching typeToMatch.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="typeToMatch"></param>
 /// <returns></returns>
 public static bool IsPrimaryType(this IModelType type, KnownPrimaryType typeToMatch) => typeToMatch == (type as PrimaryType)?.KnownPrimaryType;
コード例 #12
0
ファイル: PrimaryTypeRb.cs プロジェクト: devigned/autorest
 public PrimaryTypeRb(KnownPrimaryType primaryType) : base(primaryType)
 {
     Name.OnGet += v => ImplementationName;
 }
コード例 #13
0
ファイル: Extensions.cs プロジェクト: devigned/autorest
        public static bool IsPrimaryType(this IType type, KnownPrimaryType typeToMatch)
        {
            if (type == null)
            {
                return false;
            }

            PrimaryType primaryType = type as PrimaryType;
            return primaryType != null && primaryType.Type == typeToMatch;
        }
コード例 #14
0
 public PrimaryTypeOc(KnownPrimaryType type, string implName = null)
     : base(type)
 {
     Name.OnGet += v => implName ?? ImplementationName;
 }
コード例 #15
0
 public PrimaryTypeSDKImpl(KnownPrimaryType primary)
     : base(primary)
 {
 }
コード例 #16
0
ファイル: PrimaryType.cs プロジェクト: jhancock93/autorest
 /// <summary>
 /// Initializes a new instance of PrimaryType class from a known type.
 /// </summary>
 public PrimaryType(KnownPrimaryType type)
 {
     Type = type;
     Name = Type.ToString();
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of PrimaryType class from a known type.
 /// </summary>
 public PrimaryType(KnownPrimaryType type)
 {
     Type = type;
     Name = Type.ToString();
 }
コード例 #18
0
 /// <summary>
 ///     Initializes a new instance of PrimaryType class from a known type.
 /// </summary>
 protected PrimaryType(KnownPrimaryType knownPrimaryType)
 {
     KnownPrimaryType = knownPrimaryType;
     Name = KnownPrimaryType.ToString();
 }
コード例 #19
0
ファイル: PrimaryTypeModel.cs プロジェクト: oshvartz/autorest
 public PrimaryTypeModel(KnownPrimaryType knownPrimaryType)
     : this(new PrimaryType(knownPrimaryType))
 {
 }
コード例 #20
0
 protected PrimaryTypeCsa(KnownPrimaryType primaryType) : base(primaryType)
 {
 }
コード例 #21
0
 public PrimaryTypePy(KnownPrimaryType primaryType) : base(primaryType)
 {
     Name.OnGet += v => ImplementationName;
 }
コード例 #22
0
ファイル: PrimaryTypeJv.cs プロジェクト: m-moris/AutoRest
 public PrimaryTypeJv(KnownPrimaryType type)
     : base(type)
 {
     Name.OnGet += v => ImplementationName;
 }