diff --git a/object/object.go b/object/object.go index 640c9a9..42ffe28 100644 --- a/object/object.go +++ b/object/object.go @@ -86,3 +86,13 @@ func DefinitionFromSpec(specification Specification) *Definition { type DefinitionHolder interface { Definition() *Definition } + +type Definitions []DefinitionHolder + +func (c Definitions) Len() int { return len(c) } +func (c Definitions) Swap(i, j int) { c[i], c[j] = c[j], c[i] } +func (c Definitions) Less(i, j int) bool { + return c[i].Definition().Selector.Priority > c[j].Definition().Selector.Priority || + (c[i].Definition().Selector.Priority == c[j].Definition().Selector.Priority && + c[i].Definition().MetaData.Name > c[j].Definition().MetaData.Name) +}