http urls monitor.

xml_object.go 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright 2015 go-swagger maintainers
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package spec
  15. // XMLObject a metadata object that allows for more fine-tuned XML model definitions.
  16. //
  17. // For more information: http://goo.gl/8us55a#xmlObject
  18. type XMLObject struct {
  19. Name string `json:"name,omitempty"`
  20. Namespace string `json:"namespace,omitempty"`
  21. Prefix string `json:"prefix,omitempty"`
  22. Attribute bool `json:"attribute,omitempty"`
  23. Wrapped bool `json:"wrapped,omitempty"`
  24. }
  25. // WithName sets the xml name for the object
  26. func (x *XMLObject) WithName(name string) *XMLObject {
  27. x.Name = name
  28. return x
  29. }
  30. // WithNamespace sets the xml namespace for the object
  31. func (x *XMLObject) WithNamespace(namespace string) *XMLObject {
  32. x.Namespace = namespace
  33. return x
  34. }
  35. // WithPrefix sets the xml prefix for the object
  36. func (x *XMLObject) WithPrefix(prefix string) *XMLObject {
  37. x.Prefix = prefix
  38. return x
  39. }
  40. // AsAttribute flags this object as xml attribute
  41. func (x *XMLObject) AsAttribute() *XMLObject {
  42. x.Attribute = true
  43. return x
  44. }
  45. // AsElement flags this object as an xml node
  46. func (x *XMLObject) AsElement() *XMLObject {
  47. x.Attribute = false
  48. return x
  49. }
  50. // AsWrapped flags this object as wrapped, this is mostly useful for array types
  51. func (x *XMLObject) AsWrapped() *XMLObject {
  52. x.Wrapped = true
  53. return x
  54. }
  55. // AsUnwrapped flags this object as an xml node
  56. func (x *XMLObject) AsUnwrapped() *XMLObject {
  57. x.Wrapped = false
  58. return x
  59. }