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

http://nakedobjects.codeplex.com · C# · 177 lines · 126 code · 48 blank · 3 comment · 0 complexity · 3fba3c5d0c651c477bea5a1a960c136e 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. #endregion
  15. #region INakedObjectActionParameterSurface
  16. public static string Name(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  17. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Name);
  18. }
  19. public static string Description(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  20. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Description);
  21. }
  22. public static bool IsMandatory(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  23. return nakedObjectActionParameterSurface.GetScalarProperty<bool>(ScalarProperty.IsMandatory);
  24. }
  25. public static int? MaxLength(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  26. return nakedObjectActionParameterSurface.GetScalarProperty<int?>(ScalarProperty.MaxLength);
  27. }
  28. public static string Pattern(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  29. return nakedObjectActionParameterSurface.GetScalarProperty<string>(ScalarProperty.Pattern);
  30. }
  31. public static int Number(this INakedObjectActionParameterSurface nakedObjectActionParameterSurface) {
  32. return nakedObjectActionParameterSurface.GetScalarProperty<int>(ScalarProperty.Number);
  33. }
  34. #endregion
  35. #region INakedObjectActionSurface
  36. public static string Name(this INakedObjectActionSurface nakedObjectActionSurface) {
  37. return nakedObjectActionSurface.GetScalarProperty<string>(ScalarProperty.Name);
  38. }
  39. public static string Description(this INakedObjectActionSurface nakedObjectActionSurface) {
  40. return nakedObjectActionSurface.GetScalarProperty<string>(ScalarProperty.Description);
  41. }
  42. public static bool IsQueryOnly(this INakedObjectActionSurface nakedObjectActionSurface) {
  43. return nakedObjectActionSurface.GetScalarProperty<bool>(ScalarProperty.IsQueryOnly);
  44. }
  45. public static bool IsIdempotent(this INakedObjectActionSurface nakedObjectActionSurface) {
  46. return nakedObjectActionSurface.GetScalarProperty<bool>(ScalarProperty.IsIdempotent);
  47. }
  48. public static int MemberOrder(this INakedObjectActionSurface nakedObjectActionSurface) {
  49. return nakedObjectActionSurface.GetScalarProperty<int>(ScalarProperty.MemberOrder);
  50. }
  51. #endregion
  52. #region INakedObjectAssociationSurface
  53. public static int? MaxLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  54. return nakedObjectAssociationSurface.GetScalarProperty<int?>(ScalarProperty.MaxLength);
  55. }
  56. public static string Pattern(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  57. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Pattern);
  58. }
  59. public static bool IsMandatory(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  60. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsMandatory);
  61. }
  62. public static string Name(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  63. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Name);
  64. }
  65. public static string Description(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  66. return nakedObjectAssociationSurface.GetScalarProperty<string>(ScalarProperty.Description);
  67. }
  68. public static bool IsCollection(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  69. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsCollection);
  70. }
  71. public static bool IsObject(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  72. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsObject);
  73. }
  74. public static int MemberOrder(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  75. return nakedObjectAssociationSurface.GetScalarProperty<int>(ScalarProperty.MemberOrder);
  76. }
  77. public static bool IsASet(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  78. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsASet);
  79. }
  80. public static bool IsInline(this INakedObjectAssociationSurface nakedObjectAssociationSurface) {
  81. return nakedObjectAssociationSurface.GetScalarProperty<bool>(ScalarProperty.IsInline);
  82. }
  83. #endregion
  84. #region INakedObjectSpecificationSurface
  85. public static bool IsParseable(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  86. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsParseable);
  87. }
  88. public static bool IsQueryable(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  89. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsQueryable);
  90. }
  91. public static bool IsService(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  92. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsService);
  93. }
  94. public static bool IsVoid(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  95. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsVoid);
  96. }
  97. public static bool IsDateTime(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  98. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsDateTime);
  99. }
  100. public static bool IsCollection(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  101. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsCollection);
  102. }
  103. public static bool IsObject(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  104. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsObject);
  105. }
  106. public static string FullName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  107. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.FullName);
  108. }
  109. public static string SingularName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  110. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.SingularName);
  111. }
  112. public static string PluralName(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  113. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.PluralName);
  114. }
  115. public static string Description(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  116. return nakedObjectSpecificationSurface.GetScalarProperty<string>(ScalarProperty.Description);
  117. }
  118. public static bool IsASet(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  119. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsASet);
  120. }
  121. public static bool IsAggregated(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  122. return nakedObjectSpecificationSurface.GetScalarProperty<bool>(ScalarProperty.IsAggregated);
  123. }
  124. public static IDictionary<string, object> ExtensionData(this INakedObjectSpecificationSurface nakedObjectSpecificationSurface) {
  125. return nakedObjectSpecificationSurface.GetScalarProperty<IDictionary<string, object>>(ScalarProperty.ExtensionData);
  126. }
  127. #endregion
  128. }
  129. }