PageRenderTime 24ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Surface/NakedObjects.Surface/Utility/NakedObjectsSurfaceExtensions.cs

#
C# | 219 lines | 156 code | 60 blank | 3 comment | 0 complexity | 171a735e1e608c649c2a8e80c55e3c5d MD5 | raw file
  1. // Copyright © Naked Objects Group Ltd ( http://www.nakedobjects.net).
  2. // All Rights Reserved. This code released under the terms of the
  3. // Microsoft Public License (MS-PL) ( http://opensource.org/licenses/ms-pl.html)
  4. using System.Collections.Generic;
  5. namespace NakedObjects.Surface.Utility {
  6. public static class NakedObjectsSurfaceExtensions {
  7. #region INakedObjectSurface
  8. public static bool IsTransient(this INakedObjectSurface nakedObjectSurface) {
  9. return nakedObjectSurface.GetScalarProperty<bool>(ScalarProperty.IsTransient);
  10. }
  11. public static string TitleString(this INakedObjectSurface nakedObjectSurface) {
  12. return nakedObjectSurface.GetScalarProperty<string>(ScalarProperty.TitleString);
  13. }
  14. public static IDictionary<string, object> ExtensionData(this INakedObjectSurface nakedObjectSurface) {
  15. return nakedObjectSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  16. }
  17. #endregion
  18. #region INakedObjectActionParameterSurface
  19. public static string Name(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  20. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Name);
  21. }
  22. public static string Description(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  23. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Description);
  24. }
  25. public static bool IsMandatory(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  26. return nakedObjectActionParameterSurface.GetScalarProperty<bool>(ScalarProperty.IsMandatory);
  27. }
  28. public static int? MaxLength(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  29. return nakedObjectActionParameterSurface.GetScalarProperty<int?>(ScalarProperty.MaxLength);
  30. }
  31. public static string Pattern(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  32. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Pattern);
  33. }
  34. public static int Number(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  35. return nakedObjectActionParameterSurface.GetScalarProperty<int>(ScalarProperty.Number);
  36. }
  37. public static string Mask(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  38. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Mask);
  39. }
  40. public static int AutoCompleteMinLength(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  41. return nakedObjectActionParameterSurface.GetScalarProperty<int>(ScalarProperty.AutoCompleteMinLength);
  42. }
  43. public static IDictionary<string, object> ExtensionData(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  44. return nakedObjectActionParameterSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  45. }
  46. #endregion
  47. #region INakedObjectActionSurface
  48. public static string Name(this INakedObjectActionSurface nakedObjectActionSurface) {
  49. return nakedObjectActionSurface.GetScalarProperty<string>(ScalarProperty.Name);
  50. }
  51. public static string Description(this INakedObjectActionSurface nakedObjectActionSurface) {
  52. return nakedObjectActionSurface.GetScalarProperty<string>(ScalarProperty.Description);
  53. }
  54. public static bool IsQueryOnly(this INakedObjectActionSurface nakedObjectActionSurface) {
  55. return nakedObjectActionSurface.GetScalarProperty<bool>(ScalarProperty.IsQueryOnly);
  56. }
  57. public static bool IsIdempotent(this INakedObjectActionSurface nakedObjectActionSurface) {
  58. return nakedObjectActionSurface.GetScalarProperty<bool>(ScalarProperty.IsIdempotent);
  59. }
  60. public static int MemberOrder(this INakedObjectActionSurface nakedObjectActionSurface) {
  61. return nakedObjectActionSurface.GetScalarProperty<int>(ScalarProperty.MemberOrder);
  62. }
  63. public static IDictionary<string, object> ExtensionData(this INakedObjectActionSurface nakedObjectActionSurface) {
  64. return nakedObjectActionSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  65. }
  66. #endregion
  67. #region INakedObjectAssociationSurface
  68. public static int? MaxLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  69. return nakedObjectAssociationSurface.GetScalarProperty<int?>(ScalarProperty.MaxLength);
  70. }
  71. public static string Pattern(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  72. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Pattern);
  73. }
  74. public static bool IsMandatory(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  75. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsMandatory);
  76. }
  77. public static string Name(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  78. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Name);
  79. }
  80. public static string Description(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  81. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Description);
  82. }
  83. public static bool IsCollection(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  84. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsCollection);
  85. }
  86. public static bool IsObject(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  87. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsObject);
  88. }
  89. public static int MemberOrder(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  90. return nakedObjectAssociationSurface.GetScalarProperty<int>(ScalarProperty.MemberOrder);
  91. }
  92. public static bool IsASet(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  93. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsASet);
  94. }
  95. public static bool IsInline(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  96. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsInline);
  97. }
  98. public static string Mask(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  99. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Mask);
  100. }
  101. public static int AutoCompleteMinLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  102. return nakedObjectAssociationSurface.GetScalarProperty<int>(ScalarProperty.AutoCompleteMinLength);
  103. }
  104. public static IDictionary<string, object> ExtensionData(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  105. return nakedObjectAssociationSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  106. }
  107. #endregion
  108. #region INakedObjectSpecificationSurface
  109. public static bool IsParseable(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  110. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsParseable);
  111. }
  112. public static bool IsQueryable(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  113. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsQueryable);
  114. }
  115. public static bool IsService(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  116. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsService);
  117. }
  118. public static bool IsVoid(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  119. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsVoid);
  120. }
  121. public static bool IsDateTime(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  122. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsDateTime);
  123. }
  124. public static bool IsCollection(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  125. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsCollection);
  126. }
  127. public static bool IsObject(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  128. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsObject);
  129. }
  130. public static string FullName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  131. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.FullName);
  132. }
  133. public static string SingularName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  134. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.SingularName);
  135. }
  136. public static string PluralName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  137. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.PluralName);
  138. }
  139. public static string Description(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  140. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.Description);
  141. }
  142. public static bool IsASet(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  143. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsASet);
  144. }
  145. public static bool IsAggregated(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  146. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsAggregated);
  147. }
  148. public static bool IsImage(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  149. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsImage);
  150. }
  151. public static bool IsFileAttachment(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  152. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsFileAttachment);
  153. }
  154. public static IDictionary<string, object> ExtensionData(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  155. return nakedObjectSpecificationSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  156. }
  157. #endregion
  158. }
  159. }