private static string GetParameterBindingAttribute(IHasStereotypes stereotypeable) { const string parameterBinding = "Parameter Binding"; const string propertyType = "Type"; const string propertyCustomType = "Custom Type"; const string customValue = "Custom"; if (!stereotypeable.HasStereotype(parameterBinding)) { return(string.Empty); } var attributeName = stereotypeable.GetStereotypeProperty <string>(parameterBinding, propertyType); if (!string.Equals(attributeName, customValue, StringComparison.OrdinalIgnoreCase)) { return($"[{attributeName}]"); } var customAttributeValue = stereotypeable.GetStereotypeProperty <string>(parameterBinding, propertyCustomType); if (string.IsNullOrWhiteSpace(customAttributeValue)) { throw new Exception("Parameter Binding was set to custom but no Custom attribute type was specified"); } return($"[{customAttributeValue}]"); }
internal static IEnumerable <string> GetXmlDocLines(this IHasStereotypes hasStereotypes) { var text = hasStereotypes.GetStereotypeProperty <string>("XmlDoc", "Content"); return(string.IsNullOrWhiteSpace(text) ? new string[0] : text .Replace("\r\n", "\r") .Replace("\n", "\r") .Split('\r')); }
public static T GetPropertyValue <T>(this IHasStereotypes model, string stereotypeName, string propertyName, T defaultIfNotFound = default(T)) { return(model.GetStereotypeProperty(stereotypeName, propertyName, defaultIfNotFound)); }