diff --git a/astool/convert/convert.go b/astool/convert/convert.go index ccd87dd..4bf6b8e 100644 --- a/astool/convert/convert.go +++ b/astool/convert/convert.go @@ -877,7 +877,7 @@ func (c *Converter) packageManager(s, vocabName string) (pkg *gen.PackageManager // are the ones typically used by developers. func (c *Converter) rootFiles(pkg gen.Package, vocabName string, v vocabulary, m *gen.ManagerGenerator) (f []*File, e error) { pg := gen.NewPackageGenerator(c.typePropertyVocabName, m, c.typeProperty) - typeCtors, propCtors, ext, disj, extBy := pg.RootDefinitions(vocabName, v.typeArray(), v.propArray()) + typeCtors, propCtors, ext, disj, extBy, isA := pg.RootDefinitions(vocabName, v.typeArray(), v.propArray()) lowerVocabName := strings.ToLower(vocabName) if file := funcsToFile(pkg, typeCtors, fmt.Sprintf("gen_pkg_%s_type_constructors.go", lowerVocabName)); file != nil { f = append(f, file) @@ -894,6 +894,9 @@ func (c *Converter) rootFiles(pkg gen.Package, vocabName string, v vocabulary, m if file := funcsToFile(pkg, extBy, fmt.Sprintf("gen_pkg_%s_extendedby.go", lowerVocabName)); file != nil { f = append(f, file) } + if file := funcsToFile(pkg, isA, fmt.Sprintf("gen_pkg_%s_isorextends.go", lowerVocabName)); file != nil { + f = append(f, file) + } return } diff --git a/astool/gen/pkg.go b/astool/gen/pkg.go index d7de273..cf1178f 100644 --- a/astool/gen/pkg.go +++ b/astool/gen/pkg.go @@ -238,7 +238,7 @@ func (t *PackageGenerator) InitDefinitions(pkg Package, tgs []*TypeGenerator, pg } // RootDefinitions creates functions needed at the root level of the package declarations. -func (t *PackageGenerator) RootDefinitions(vocabName string, tgs []*TypeGenerator, pgs []*PropertyGenerator) (typeCtors, propCtors, ext, disj, extBy []*codegen.Function) { +func (t *PackageGenerator) RootDefinitions(vocabName string, tgs []*TypeGenerator, pgs []*PropertyGenerator) (typeCtors, propCtors, ext, disj, extBy, isA []*codegen.Function) { return rootDefinitions(vocabName, t.m, tgs, pgs) } @@ -337,7 +337,7 @@ func publicTypeDefinitions(tgs []*TypeGenerator) (typeI *codegen.Interface) { // rootDefinitions creates common functions needed at the root level of the // package declarations. -func rootDefinitions(vocabName string, m *ManagerGenerator, tgs []*TypeGenerator, pgs []*PropertyGenerator) (typeCtors, propCtors, ext, disj, extBy []*codegen.Function) { +func rootDefinitions(vocabName string, m *ManagerGenerator, tgs []*TypeGenerator, pgs []*PropertyGenerator) (typeCtors, propCtors, ext, disj, extBy, isA []*codegen.Function) { // Type constructors for _, tg := range tgs { typeCtors = append(typeCtors, codegen.NewCommentedFunction( @@ -356,6 +356,22 @@ func rootDefinitions(vocabName string, m *ManagerGenerator, tgs []*TypeGenerator for _, pg := range pgs { propCtors = append(propCtors, toPublicConstructor(vocabName, m, pg)) } + // Is + for _, tg := range tgs { + f := tg.isATypeDefinition() + name := fmt.Sprintf("%s%s%s", isAMethod, vocabName, tg.TypeName()) + isA = append(isA, codegen.NewCommentedFunction( + m.pkg.Path(), + name, + []jen.Code{jen.Id("other").Qual(tg.PublicPackage().Path(), typeInterfaceName)}, + []jen.Code{jen.Bool()}, + []jen.Code{ + jen.Return( + f.Call(jen.Id("other")), + ), + }, + fmt.Sprintf("%s returns true if the other provided type is the %s type or extends from the %s type.", name, tg.TypeName(), tg.TypeName()))) + } // Extends for _, tg := range tgs { f, _ := tg.extendsDefinition() @@ -402,7 +418,7 @@ func rootDefinitions(vocabName string, m *ManagerGenerator, tgs []*TypeGenerator f.Call(jen.Id("other")), ), }, - fmt.Sprintf("%s returns true if the other's type extends from %s.", name, tg.TypeName()))) + fmt.Sprintf("%s returns true if the other's type extends from %s. Note that it returns false if the types are the same; see the %q variant instead.", name, tg.TypeName(), isAMethod))) } return } diff --git a/astool/gen/type.go b/astool/gen/type.go index 1461f57..541c3c8 100644 --- a/astool/gen/type.go +++ b/astool/gen/type.go @@ -17,6 +17,7 @@ const ( extendedByMethod = "IsExtendedBy" extendingMethod = "IsExtending" extendsMethod = "Extends" + isAMethod = "IsOrExtends" disjointWithMethod = "IsDisjointWith" typeNameMethod = "GetTypeName" vocabURIMethod = "VocabularyURI" @@ -345,6 +346,13 @@ func (t *TypeGenerator) extendedByFnName() string { return fmt.Sprintf("%s%s", t.TypeName(), extendedByMethod) } +// isATypeFnName determines the name of the IsA function, which determines if +// this Type is the same as the other one or if another ActivityStreams type +// extends this one. +func (t *TypeGenerator) isATypeFnName() string { + return fmt.Sprintf("%s%s", isAMethod, t.TypeName()) +} + // disjointWithFnName determines the name of the DisjointWith function, which // determines if another ActivityStreams type is disjoint with this one. func (t *TypeGenerator) disjointWithFnName() string { @@ -397,6 +405,7 @@ func (t *TypeGenerator) Definition() *codegen.Struct { ), []*codegen.Function{ constructor, + t.isATypeDefinition(), t.extendedByDefinition(), extendsFn, t.disjointWithDefinition(), @@ -587,6 +596,30 @@ func (t *TypeGenerator) getAllChildrenExtendedBy(s []string, tg *TypeGenerator) return s } +// isATypeDefinition generates the golang function for determining if another +// ActivityStreams type is this type or extends this type. It requires the Type +// interface. +func (t *TypeGenerator) isATypeDefinition() *codegen.Function { + return codegen.NewCommentedFunction( + t.PrivatePackage().Path(), + t.isATypeFnName(), + []jen.Code{jen.Id("other").Qual(t.PublicPackage().Path(), typeInterfaceName)}, + []jen.Code{jen.Bool()}, + []jen.Code{ + jen.If( + jen.Id("other").Dot(typeNameMethod).Call().Op("==").Lit(t.TypeName()), + ).Block( + jen.Return(jen.True()), + ), + jen.Return( + jen.Id(codegen.This()).Dot(t.extendedByFnName()).Call( + jen.Id("other"), + ), + ), + }, + fmt.Sprintf("%s returns true if the other provided type is the %s type or extends from the %s type.", t.isATypeFnName(), t.TypeName(), t.TypeName())) +} + // extendedByDefinition generates the golang function for determining if // another ActivityStreams type extends this type. It requires the Type // interface. @@ -617,7 +650,7 @@ func (t *TypeGenerator) extendedByDefinition() *codegen.Function { []jen.Code{jen.Id("other").Qual(t.PublicPackage().Path(), typeInterfaceName)}, []jen.Code{jen.Bool()}, impl, - fmt.Sprintf("%s returns true if the other provided type extends from the %s type.", t.extendedByFnName(), t.TypeName())) + fmt.Sprintf("%s returns true if the other provided type extends from the %s type. Note that it returns false if the types are the same; see the %q variant instead.", t.extendedByFnName(), t.TypeName(), t.isATypeFnName())) } // getAllChildrenDisjointWith recursivley determines all the child types that this diff --git a/streams/gen_pkg_activitystreams_extendedby.go b/streams/gen_pkg_activitystreams_extendedby.go index 1b01159..60448d7 100644 --- a/streams/gen_pkg_activitystreams_extendedby.go +++ b/streams/gen_pkg_activitystreams_extendedby.go @@ -59,325 +59,379 @@ import ( ) // ActivityStreamsAcceptIsExtendedBy returns true if the other's type extends from -// Accept. +// Accept. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsAcceptIsExtendedBy(other vocab.Type) bool { return typeaccept.AcceptIsExtendedBy(other) } // ActivityStreamsActivityIsExtendedBy returns true if the other's type extends -// from Activity. +// from Activity. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsActivityIsExtendedBy(other vocab.Type) bool { return typeactivity.ActivityIsExtendedBy(other) } // ActivityStreamsAddIsExtendedBy returns true if the other's type extends from -// Add. +// Add. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsAddIsExtendedBy(other vocab.Type) bool { return typeadd.AddIsExtendedBy(other) } // ActivityStreamsAnnounceIsExtendedBy returns true if the other's type extends -// from Announce. +// from Announce. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsAnnounceIsExtendedBy(other vocab.Type) bool { return typeannounce.AnnounceIsExtendedBy(other) } // ActivityStreamsApplicationIsExtendedBy returns true if the other's type extends -// from Application. +// from Application. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsApplicationIsExtendedBy(other vocab.Type) bool { return typeapplication.ApplicationIsExtendedBy(other) } // ActivityStreamsArriveIsExtendedBy returns true if the other's type extends from -// Arrive. +// Arrive. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsArriveIsExtendedBy(other vocab.Type) bool { return typearrive.ArriveIsExtendedBy(other) } // ActivityStreamsArticleIsExtendedBy returns true if the other's type extends -// from Article. +// from Article. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsArticleIsExtendedBy(other vocab.Type) bool { return typearticle.ArticleIsExtendedBy(other) } // ActivityStreamsAudioIsExtendedBy returns true if the other's type extends from -// Audio. +// Audio. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsAudioIsExtendedBy(other vocab.Type) bool { return typeaudio.AudioIsExtendedBy(other) } // ActivityStreamsBlockIsExtendedBy returns true if the other's type extends from -// Block. +// Block. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsBlockIsExtendedBy(other vocab.Type) bool { return typeblock.BlockIsExtendedBy(other) } // ActivityStreamsCollectionIsExtendedBy returns true if the other's type extends -// from Collection. +// from Collection. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsCollectionIsExtendedBy(other vocab.Type) bool { return typecollection.CollectionIsExtendedBy(other) } // ActivityStreamsCollectionPageIsExtendedBy returns true if the other's type -// extends from CollectionPage. +// extends from CollectionPage. Note that it returns false if the types are +// the same; see the "IsOrExtends" variant instead. func ActivityStreamsCollectionPageIsExtendedBy(other vocab.Type) bool { return typecollectionpage.CollectionPageIsExtendedBy(other) } // ActivityStreamsCreateIsExtendedBy returns true if the other's type extends from -// Create. +// Create. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsCreateIsExtendedBy(other vocab.Type) bool { return typecreate.CreateIsExtendedBy(other) } // ActivityStreamsDeleteIsExtendedBy returns true if the other's type extends from -// Delete. +// Delete. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsDeleteIsExtendedBy(other vocab.Type) bool { return typedelete.DeleteIsExtendedBy(other) } // ActivityStreamsDislikeIsExtendedBy returns true if the other's type extends -// from Dislike. +// from Dislike. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsDislikeIsExtendedBy(other vocab.Type) bool { return typedislike.DislikeIsExtendedBy(other) } // ActivityStreamsDocumentIsExtendedBy returns true if the other's type extends -// from Document. +// from Document. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsDocumentIsExtendedBy(other vocab.Type) bool { return typedocument.DocumentIsExtendedBy(other) } // ActivityStreamsEventIsExtendedBy returns true if the other's type extends from -// Event. +// Event. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsEventIsExtendedBy(other vocab.Type) bool { return typeevent.EventIsExtendedBy(other) } // ActivityStreamsFlagIsExtendedBy returns true if the other's type extends from -// Flag. +// Flag. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsFlagIsExtendedBy(other vocab.Type) bool { return typeflag.FlagIsExtendedBy(other) } // ActivityStreamsFollowIsExtendedBy returns true if the other's type extends from -// Follow. +// Follow. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsFollowIsExtendedBy(other vocab.Type) bool { return typefollow.FollowIsExtendedBy(other) } // ActivityStreamsGroupIsExtendedBy returns true if the other's type extends from -// Group. +// Group. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsGroupIsExtendedBy(other vocab.Type) bool { return typegroup.GroupIsExtendedBy(other) } // ActivityStreamsIgnoreIsExtendedBy returns true if the other's type extends from -// Ignore. +// Ignore. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsIgnoreIsExtendedBy(other vocab.Type) bool { return typeignore.IgnoreIsExtendedBy(other) } // ActivityStreamsImageIsExtendedBy returns true if the other's type extends from -// Image. +// Image. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsImageIsExtendedBy(other vocab.Type) bool { return typeimage.ImageIsExtendedBy(other) } // ActivityStreamsIntransitiveActivityIsExtendedBy returns true if the other's -// type extends from IntransitiveActivity. +// type extends from IntransitiveActivity. Note that it returns false if the +// types are the same; see the "IsOrExtends" variant instead. func ActivityStreamsIntransitiveActivityIsExtendedBy(other vocab.Type) bool { return typeintransitiveactivity.IntransitiveActivityIsExtendedBy(other) } // ActivityStreamsInviteIsExtendedBy returns true if the other's type extends from -// Invite. +// Invite. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsInviteIsExtendedBy(other vocab.Type) bool { return typeinvite.InviteIsExtendedBy(other) } // ActivityStreamsJoinIsExtendedBy returns true if the other's type extends from -// Join. +// Join. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsJoinIsExtendedBy(other vocab.Type) bool { return typejoin.JoinIsExtendedBy(other) } // ActivityStreamsLeaveIsExtendedBy returns true if the other's type extends from -// Leave. +// Leave. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsLeaveIsExtendedBy(other vocab.Type) bool { return typeleave.LeaveIsExtendedBy(other) } // ActivityStreamsLikeIsExtendedBy returns true if the other's type extends from -// Like. +// Like. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsLikeIsExtendedBy(other vocab.Type) bool { return typelike.LikeIsExtendedBy(other) } // ActivityStreamsLinkIsExtendedBy returns true if the other's type extends from -// Link. +// Link. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsLinkIsExtendedBy(other vocab.Type) bool { return typelink.LinkIsExtendedBy(other) } // ActivityStreamsListenIsExtendedBy returns true if the other's type extends from -// Listen. +// Listen. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsListenIsExtendedBy(other vocab.Type) bool { return typelisten.ListenIsExtendedBy(other) } // ActivityStreamsMentionIsExtendedBy returns true if the other's type extends -// from Mention. +// from Mention. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsMentionIsExtendedBy(other vocab.Type) bool { return typemention.MentionIsExtendedBy(other) } // ActivityStreamsMoveIsExtendedBy returns true if the other's type extends from -// Move. +// Move. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsMoveIsExtendedBy(other vocab.Type) bool { return typemove.MoveIsExtendedBy(other) } // ActivityStreamsNoteIsExtendedBy returns true if the other's type extends from -// Note. +// Note. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsNoteIsExtendedBy(other vocab.Type) bool { return typenote.NoteIsExtendedBy(other) } // ActivityStreamsObjectIsExtendedBy returns true if the other's type extends from -// Object. +// Object. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsObjectIsExtendedBy(other vocab.Type) bool { return typeobject.ObjectIsExtendedBy(other) } // ActivityStreamsOfferIsExtendedBy returns true if the other's type extends from -// Offer. +// Offer. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsOfferIsExtendedBy(other vocab.Type) bool { return typeoffer.OfferIsExtendedBy(other) } // ActivityStreamsOrderedCollectionIsExtendedBy returns true if the other's type -// extends from OrderedCollection. +// extends from OrderedCollection. Note that it returns false if the types are +// the same; see the "IsOrExtends" variant instead. func ActivityStreamsOrderedCollectionIsExtendedBy(other vocab.Type) bool { return typeorderedcollection.OrderedCollectionIsExtendedBy(other) } // ActivityStreamsOrderedCollectionPageIsExtendedBy returns true if the other's -// type extends from OrderedCollectionPage. +// type extends from OrderedCollectionPage. Note that it returns false if the +// types are the same; see the "IsOrExtends" variant instead. func ActivityStreamsOrderedCollectionPageIsExtendedBy(other vocab.Type) bool { return typeorderedcollectionpage.OrderedCollectionPageIsExtendedBy(other) } // ActivityStreamsOrganizationIsExtendedBy returns true if the other's type -// extends from Organization. +// extends from Organization. Note that it returns false if the types are the +// same; see the "IsOrExtends" variant instead. func ActivityStreamsOrganizationIsExtendedBy(other vocab.Type) bool { return typeorganization.OrganizationIsExtendedBy(other) } // ActivityStreamsPageIsExtendedBy returns true if the other's type extends from -// Page. +// Page. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsPageIsExtendedBy(other vocab.Type) bool { return typepage.PageIsExtendedBy(other) } // ActivityStreamsPersonIsExtendedBy returns true if the other's type extends from -// Person. +// Person. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsPersonIsExtendedBy(other vocab.Type) bool { return typeperson.PersonIsExtendedBy(other) } // ActivityStreamsPlaceIsExtendedBy returns true if the other's type extends from -// Place. +// Place. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsPlaceIsExtendedBy(other vocab.Type) bool { return typeplace.PlaceIsExtendedBy(other) } // ActivityStreamsProfileIsExtendedBy returns true if the other's type extends -// from Profile. +// from Profile. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsProfileIsExtendedBy(other vocab.Type) bool { return typeprofile.ProfileIsExtendedBy(other) } // ActivityStreamsQuestionIsExtendedBy returns true if the other's type extends -// from Question. +// from Question. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsQuestionIsExtendedBy(other vocab.Type) bool { return typequestion.QuestionIsExtendedBy(other) } // ActivityStreamsReadIsExtendedBy returns true if the other's type extends from -// Read. +// Read. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsReadIsExtendedBy(other vocab.Type) bool { return typeread.ReadIsExtendedBy(other) } // ActivityStreamsRejectIsExtendedBy returns true if the other's type extends from -// Reject. +// Reject. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsRejectIsExtendedBy(other vocab.Type) bool { return typereject.RejectIsExtendedBy(other) } // ActivityStreamsRelationshipIsExtendedBy returns true if the other's type -// extends from Relationship. +// extends from Relationship. Note that it returns false if the types are the +// same; see the "IsOrExtends" variant instead. func ActivityStreamsRelationshipIsExtendedBy(other vocab.Type) bool { return typerelationship.RelationshipIsExtendedBy(other) } // ActivityStreamsRemoveIsExtendedBy returns true if the other's type extends from -// Remove. +// Remove. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsRemoveIsExtendedBy(other vocab.Type) bool { return typeremove.RemoveIsExtendedBy(other) } // ActivityStreamsServiceIsExtendedBy returns true if the other's type extends -// from Service. +// from Service. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsServiceIsExtendedBy(other vocab.Type) bool { return typeservice.ServiceIsExtendedBy(other) } // ActivityStreamsTentativeAcceptIsExtendedBy returns true if the other's type -// extends from TentativeAccept. +// extends from TentativeAccept. Note that it returns false if the types are +// the same; see the "IsOrExtends" variant instead. func ActivityStreamsTentativeAcceptIsExtendedBy(other vocab.Type) bool { return typetentativeaccept.TentativeAcceptIsExtendedBy(other) } // ActivityStreamsTentativeRejectIsExtendedBy returns true if the other's type -// extends from TentativeReject. +// extends from TentativeReject. Note that it returns false if the types are +// the same; see the "IsOrExtends" variant instead. func ActivityStreamsTentativeRejectIsExtendedBy(other vocab.Type) bool { return typetentativereject.TentativeRejectIsExtendedBy(other) } // ActivityStreamsTombstoneIsExtendedBy returns true if the other's type extends -// from Tombstone. +// from Tombstone. Note that it returns false if the types are the same; see +// the "IsOrExtends" variant instead. func ActivityStreamsTombstoneIsExtendedBy(other vocab.Type) bool { return typetombstone.TombstoneIsExtendedBy(other) } // ActivityStreamsTravelIsExtendedBy returns true if the other's type extends from -// Travel. +// Travel. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsTravelIsExtendedBy(other vocab.Type) bool { return typetravel.TravelIsExtendedBy(other) } // ActivityStreamsUndoIsExtendedBy returns true if the other's type extends from -// Undo. +// Undo. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsUndoIsExtendedBy(other vocab.Type) bool { return typeundo.UndoIsExtendedBy(other) } // ActivityStreamsUpdateIsExtendedBy returns true if the other's type extends from -// Update. +// Update. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsUpdateIsExtendedBy(other vocab.Type) bool { return typeupdate.UpdateIsExtendedBy(other) } // ActivityStreamsVideoIsExtendedBy returns true if the other's type extends from -// Video. +// Video. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsVideoIsExtendedBy(other vocab.Type) bool { return typevideo.VideoIsExtendedBy(other) } // ActivityStreamsViewIsExtendedBy returns true if the other's type extends from -// View. +// View. Note that it returns false if the types are the same; see the +// "IsOrExtends" variant instead. func ActivityStreamsViewIsExtendedBy(other vocab.Type) bool { return typeview.ViewIsExtendedBy(other) } diff --git a/streams/gen_pkg_activitystreams_isorextends.go b/streams/gen_pkg_activitystreams_isorextends.go new file mode 100644 index 0000000..badd066 --- /dev/null +++ b/streams/gen_pkg_activitystreams_isorextends.go @@ -0,0 +1,386 @@ +package streams + +import ( + typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept" + typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity" + typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add" + typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce" + typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application" + typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive" + typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article" + typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio" + typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block" + typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection" + typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage" + typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create" + typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete" + typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike" + typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document" + typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event" + typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag" + typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow" + typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group" + typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore" + typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image" + typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity" + typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite" + typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join" + typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave" + typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like" + typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link" + typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen" + typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention" + typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move" + typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note" + typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object" + typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer" + typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection" + typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage" + typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization" + typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page" + typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person" + typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place" + typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile" + typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question" + typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read" + typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject" + typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship" + typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove" + typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service" + typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept" + typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject" + typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone" + typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel" + typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo" + typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update" + typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video" + typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view" + vocab "github.com/go-fed/activity/streams/vocab" +) + +// IsOrExtendsActivityStreamsAccept returns true if the other provided type is the +// Accept type or extends from the Accept type. +func IsOrExtendsActivityStreamsAccept(other vocab.Type) bool { + return typeaccept.IsOrExtendsAccept(other) +} + +// IsOrExtendsActivityStreamsActivity returns true if the other provided type is +// the Activity type or extends from the Activity type. +func IsOrExtendsActivityStreamsActivity(other vocab.Type) bool { + return typeactivity.IsOrExtendsActivity(other) +} + +// IsOrExtendsActivityStreamsAdd returns true if the other provided type is the +// Add type or extends from the Add type. +func IsOrExtendsActivityStreamsAdd(other vocab.Type) bool { + return typeadd.IsOrExtendsAdd(other) +} + +// IsOrExtendsActivityStreamsAnnounce returns true if the other provided type is +// the Announce type or extends from the Announce type. +func IsOrExtendsActivityStreamsAnnounce(other vocab.Type) bool { + return typeannounce.IsOrExtendsAnnounce(other) +} + +// IsOrExtendsActivityStreamsApplication returns true if the other provided type +// is the Application type or extends from the Application type. +func IsOrExtendsActivityStreamsApplication(other vocab.Type) bool { + return typeapplication.IsOrExtendsApplication(other) +} + +// IsOrExtendsActivityStreamsArrive returns true if the other provided type is the +// Arrive type or extends from the Arrive type. +func IsOrExtendsActivityStreamsArrive(other vocab.Type) bool { + return typearrive.IsOrExtendsArrive(other) +} + +// IsOrExtendsActivityStreamsArticle returns true if the other provided type is +// the Article type or extends from the Article type. +func IsOrExtendsActivityStreamsArticle(other vocab.Type) bool { + return typearticle.IsOrExtendsArticle(other) +} + +// IsOrExtendsActivityStreamsAudio returns true if the other provided type is the +// Audio type or extends from the Audio type. +func IsOrExtendsActivityStreamsAudio(other vocab.Type) bool { + return typeaudio.IsOrExtendsAudio(other) +} + +// IsOrExtendsActivityStreamsBlock returns true if the other provided type is the +// Block type or extends from the Block type. +func IsOrExtendsActivityStreamsBlock(other vocab.Type) bool { + return typeblock.IsOrExtendsBlock(other) +} + +// IsOrExtendsActivityStreamsCollection returns true if the other provided type is +// the Collection type or extends from the Collection type. +func IsOrExtendsActivityStreamsCollection(other vocab.Type) bool { + return typecollection.IsOrExtendsCollection(other) +} + +// IsOrExtendsActivityStreamsCollectionPage returns true if the other provided +// type is the CollectionPage type or extends from the CollectionPage type. +func IsOrExtendsActivityStreamsCollectionPage(other vocab.Type) bool { + return typecollectionpage.IsOrExtendsCollectionPage(other) +} + +// IsOrExtendsActivityStreamsCreate returns true if the other provided type is the +// Create type or extends from the Create type. +func IsOrExtendsActivityStreamsCreate(other vocab.Type) bool { + return typecreate.IsOrExtendsCreate(other) +} + +// IsOrExtendsActivityStreamsDelete returns true if the other provided type is the +// Delete type or extends from the Delete type. +func IsOrExtendsActivityStreamsDelete(other vocab.Type) bool { + return typedelete.IsOrExtendsDelete(other) +} + +// IsOrExtendsActivityStreamsDislike returns true if the other provided type is +// the Dislike type or extends from the Dislike type. +func IsOrExtendsActivityStreamsDislike(other vocab.Type) bool { + return typedislike.IsOrExtendsDislike(other) +} + +// IsOrExtendsActivityStreamsDocument returns true if the other provided type is +// the Document type or extends from the Document type. +func IsOrExtendsActivityStreamsDocument(other vocab.Type) bool { + return typedocument.IsOrExtendsDocument(other) +} + +// IsOrExtendsActivityStreamsEvent returns true if the other provided type is the +// Event type or extends from the Event type. +func IsOrExtendsActivityStreamsEvent(other vocab.Type) bool { + return typeevent.IsOrExtendsEvent(other) +} + +// IsOrExtendsActivityStreamsFlag returns true if the other provided type is the +// Flag type or extends from the Flag type. +func IsOrExtendsActivityStreamsFlag(other vocab.Type) bool { + return typeflag.IsOrExtendsFlag(other) +} + +// IsOrExtendsActivityStreamsFollow returns true if the other provided type is the +// Follow type or extends from the Follow type. +func IsOrExtendsActivityStreamsFollow(other vocab.Type) bool { + return typefollow.IsOrExtendsFollow(other) +} + +// IsOrExtendsActivityStreamsGroup returns true if the other provided type is the +// Group type or extends from the Group type. +func IsOrExtendsActivityStreamsGroup(other vocab.Type) bool { + return typegroup.IsOrExtendsGroup(other) +} + +// IsOrExtendsActivityStreamsIgnore returns true if the other provided type is the +// Ignore type or extends from the Ignore type. +func IsOrExtendsActivityStreamsIgnore(other vocab.Type) bool { + return typeignore.IsOrExtendsIgnore(other) +} + +// IsOrExtendsActivityStreamsImage returns true if the other provided type is the +// Image type or extends from the Image type. +func IsOrExtendsActivityStreamsImage(other vocab.Type) bool { + return typeimage.IsOrExtendsImage(other) +} + +// IsOrExtendsActivityStreamsIntransitiveActivity returns true if the other +// provided type is the IntransitiveActivity type or extends from the +// IntransitiveActivity type. +func IsOrExtendsActivityStreamsIntransitiveActivity(other vocab.Type) bool { + return typeintransitiveactivity.IsOrExtendsIntransitiveActivity(other) +} + +// IsOrExtendsActivityStreamsInvite returns true if the other provided type is the +// Invite type or extends from the Invite type. +func IsOrExtendsActivityStreamsInvite(other vocab.Type) bool { + return typeinvite.IsOrExtendsInvite(other) +} + +// IsOrExtendsActivityStreamsJoin returns true if the other provided type is the +// Join type or extends from the Join type. +func IsOrExtendsActivityStreamsJoin(other vocab.Type) bool { + return typejoin.IsOrExtendsJoin(other) +} + +// IsOrExtendsActivityStreamsLeave returns true if the other provided type is the +// Leave type or extends from the Leave type. +func IsOrExtendsActivityStreamsLeave(other vocab.Type) bool { + return typeleave.IsOrExtendsLeave(other) +} + +// IsOrExtendsActivityStreamsLike returns true if the other provided type is the +// Like type or extends from the Like type. +func IsOrExtendsActivityStreamsLike(other vocab.Type) bool { + return typelike.IsOrExtendsLike(other) +} + +// IsOrExtendsActivityStreamsLink returns true if the other provided type is the +// Link type or extends from the Link type. +func IsOrExtendsActivityStreamsLink(other vocab.Type) bool { + return typelink.IsOrExtendsLink(other) +} + +// IsOrExtendsActivityStreamsListen returns true if the other provided type is the +// Listen type or extends from the Listen type. +func IsOrExtendsActivityStreamsListen(other vocab.Type) bool { + return typelisten.IsOrExtendsListen(other) +} + +// IsOrExtendsActivityStreamsMention returns true if the other provided type is +// the Mention type or extends from the Mention type. +func IsOrExtendsActivityStreamsMention(other vocab.Type) bool { + return typemention.IsOrExtendsMention(other) +} + +// IsOrExtendsActivityStreamsMove returns true if the other provided type is the +// Move type or extends from the Move type. +func IsOrExtendsActivityStreamsMove(other vocab.Type) bool { + return typemove.IsOrExtendsMove(other) +} + +// IsOrExtendsActivityStreamsNote returns true if the other provided type is the +// Note type or extends from the Note type. +func IsOrExtendsActivityStreamsNote(other vocab.Type) bool { + return typenote.IsOrExtendsNote(other) +} + +// IsOrExtendsActivityStreamsObject returns true if the other provided type is the +// Object type or extends from the Object type. +func IsOrExtendsActivityStreamsObject(other vocab.Type) bool { + return typeobject.IsOrExtendsObject(other) +} + +// IsOrExtendsActivityStreamsOffer returns true if the other provided type is the +// Offer type or extends from the Offer type. +func IsOrExtendsActivityStreamsOffer(other vocab.Type) bool { + return typeoffer.IsOrExtendsOffer(other) +} + +// IsOrExtendsActivityStreamsOrderedCollection returns true if the other provided +// type is the OrderedCollection type or extends from the OrderedCollection +// type. +func IsOrExtendsActivityStreamsOrderedCollection(other vocab.Type) bool { + return typeorderedcollection.IsOrExtendsOrderedCollection(other) +} + +// IsOrExtendsActivityStreamsOrderedCollectionPage returns true if the other +// provided type is the OrderedCollectionPage type or extends from the +// OrderedCollectionPage type. +func IsOrExtendsActivityStreamsOrderedCollectionPage(other vocab.Type) bool { + return typeorderedcollectionpage.IsOrExtendsOrderedCollectionPage(other) +} + +// IsOrExtendsActivityStreamsOrganization returns true if the other provided type +// is the Organization type or extends from the Organization type. +func IsOrExtendsActivityStreamsOrganization(other vocab.Type) bool { + return typeorganization.IsOrExtendsOrganization(other) +} + +// IsOrExtendsActivityStreamsPage returns true if the other provided type is the +// Page type or extends from the Page type. +func IsOrExtendsActivityStreamsPage(other vocab.Type) bool { + return typepage.IsOrExtendsPage(other) +} + +// IsOrExtendsActivityStreamsPerson returns true if the other provided type is the +// Person type or extends from the Person type. +func IsOrExtendsActivityStreamsPerson(other vocab.Type) bool { + return typeperson.IsOrExtendsPerson(other) +} + +// IsOrExtendsActivityStreamsPlace returns true if the other provided type is the +// Place type or extends from the Place type. +func IsOrExtendsActivityStreamsPlace(other vocab.Type) bool { + return typeplace.IsOrExtendsPlace(other) +} + +// IsOrExtendsActivityStreamsProfile returns true if the other provided type is +// the Profile type or extends from the Profile type. +func IsOrExtendsActivityStreamsProfile(other vocab.Type) bool { + return typeprofile.IsOrExtendsProfile(other) +} + +// IsOrExtendsActivityStreamsQuestion returns true if the other provided type is +// the Question type or extends from the Question type. +func IsOrExtendsActivityStreamsQuestion(other vocab.Type) bool { + return typequestion.IsOrExtendsQuestion(other) +} + +// IsOrExtendsActivityStreamsRead returns true if the other provided type is the +// Read type or extends from the Read type. +func IsOrExtendsActivityStreamsRead(other vocab.Type) bool { + return typeread.IsOrExtendsRead(other) +} + +// IsOrExtendsActivityStreamsReject returns true if the other provided type is the +// Reject type or extends from the Reject type. +func IsOrExtendsActivityStreamsReject(other vocab.Type) bool { + return typereject.IsOrExtendsReject(other) +} + +// IsOrExtendsActivityStreamsRelationship returns true if the other provided type +// is the Relationship type or extends from the Relationship type. +func IsOrExtendsActivityStreamsRelationship(other vocab.Type) bool { + return typerelationship.IsOrExtendsRelationship(other) +} + +// IsOrExtendsActivityStreamsRemove returns true if the other provided type is the +// Remove type or extends from the Remove type. +func IsOrExtendsActivityStreamsRemove(other vocab.Type) bool { + return typeremove.IsOrExtendsRemove(other) +} + +// IsOrExtendsActivityStreamsService returns true if the other provided type is +// the Service type or extends from the Service type. +func IsOrExtendsActivityStreamsService(other vocab.Type) bool { + return typeservice.IsOrExtendsService(other) +} + +// IsOrExtendsActivityStreamsTentativeAccept returns true if the other provided +// type is the TentativeAccept type or extends from the TentativeAccept type. +func IsOrExtendsActivityStreamsTentativeAccept(other vocab.Type) bool { + return typetentativeaccept.IsOrExtendsTentativeAccept(other) +} + +// IsOrExtendsActivityStreamsTentativeReject returns true if the other provided +// type is the TentativeReject type or extends from the TentativeReject type. +func IsOrExtendsActivityStreamsTentativeReject(other vocab.Type) bool { + return typetentativereject.IsOrExtendsTentativeReject(other) +} + +// IsOrExtendsActivityStreamsTombstone returns true if the other provided type is +// the Tombstone type or extends from the Tombstone type. +func IsOrExtendsActivityStreamsTombstone(other vocab.Type) bool { + return typetombstone.IsOrExtendsTombstone(other) +} + +// IsOrExtendsActivityStreamsTravel returns true if the other provided type is the +// Travel type or extends from the Travel type. +func IsOrExtendsActivityStreamsTravel(other vocab.Type) bool { + return typetravel.IsOrExtendsTravel(other) +} + +// IsOrExtendsActivityStreamsUndo returns true if the other provided type is the +// Undo type or extends from the Undo type. +func IsOrExtendsActivityStreamsUndo(other vocab.Type) bool { + return typeundo.IsOrExtendsUndo(other) +} + +// IsOrExtendsActivityStreamsUpdate returns true if the other provided type is the +// Update type or extends from the Update type. +func IsOrExtendsActivityStreamsUpdate(other vocab.Type) bool { + return typeupdate.IsOrExtendsUpdate(other) +} + +// IsOrExtendsActivityStreamsVideo returns true if the other provided type is the +// Video type or extends from the Video type. +func IsOrExtendsActivityStreamsVideo(other vocab.Type) bool { + return typevideo.IsOrExtendsVideo(other) +} + +// IsOrExtendsActivityStreamsView returns true if the other provided type is the +// View type or extends from the View type. +func IsOrExtendsActivityStreamsView(other vocab.Type) bool { + return typeview.IsOrExtendsView(other) +} diff --git a/streams/impl/activitystreams/type_accept/gen_type_activitystreams_accept.go b/streams/impl/activitystreams/type_accept/gen_type_activitystreams_accept.go index 7554cd2..b30f41b 100644 --- a/streams/impl/activitystreams/type_accept/gen_type_activitystreams_accept.go +++ b/streams/impl/activitystreams/type_accept/gen_type_activitystreams_accept.go @@ -100,7 +100,8 @@ func AcceptIsDisjointWith(other vocab.Type) bool { } // AcceptIsExtendedBy returns true if the other provided type extends from the -// Accept type. +// Accept type. Note that it returns false if the types are the same; see the +// "IsOrExtendsAccept" variant instead. func AcceptIsExtendedBy(other vocab.Type) bool { extensions := []string{"TentativeAccept"} for _, ext := range extensions { @@ -439,6 +440,15 @@ func DeserializeAccept(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsAccept returns true if the other provided type is the Accept type or +// extends from the Accept type. +func IsOrExtendsAccept(other vocab.Type) bool { + if other.GetTypeName() == "Accept" { + return true + } + return this.AcceptIsExtendedBy(other) +} + // NewActivityStreamsAccept creates a new Accept type func NewActivityStreamsAccept() *ActivityStreamsAccept { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_activity/gen_type_activitystreams_activity.go b/streams/impl/activitystreams/type_activity/gen_type_activitystreams_activity.go index 70f57c6..d2782f6 100644 --- a/streams/impl/activitystreams/type_activity/gen_type_activitystreams_activity.go +++ b/streams/impl/activitystreams/type_activity/gen_type_activitystreams_activity.go @@ -80,7 +80,8 @@ func ActivityIsDisjointWith(other vocab.Type) bool { } // ActivityIsExtendedBy returns true if the other provided type extends from the -// Activity type. +// Activity type. Note that it returns false if the types are the same; see +// the "IsOrExtendsActivity" variant instead. func ActivityIsExtendedBy(other vocab.Type) bool { extensions := []string{"Accept", "Add", "Announce", "Arrive", "Block", "Create", "Delete", "Dislike", "Flag", "Follow", "Ignore", "IntransitiveActivity", "Invite", "Join", "Leave", "Like", "Listen", "Move", "Offer", "Question", "Read", "Reject", "Remove", "TentativeAccept", "TentativeReject", "Travel", "Undo", "Update", "View"} for _, ext := range extensions { @@ -419,6 +420,15 @@ func DeserializeActivity(m map[string]interface{}, aliasMap map[string]string) ( return this, nil } +// IsOrExtendsActivity returns true if the other provided type is the Activity +// type or extends from the Activity type. +func IsOrExtendsActivity(other vocab.Type) bool { + if other.GetTypeName() == "Activity" { + return true + } + return this.ActivityIsExtendedBy(other) +} + // NewActivityStreamsActivity creates a new Activity type func NewActivityStreamsActivity() *ActivityStreamsActivity { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_add/gen_type_activitystreams_add.go b/streams/impl/activitystreams/type_add/gen_type_activitystreams_add.go index bddc910..3678adf 100644 --- a/streams/impl/activitystreams/type_add/gen_type_activitystreams_add.go +++ b/streams/impl/activitystreams/type_add/gen_type_activitystreams_add.go @@ -112,7 +112,8 @@ func AddIsDisjointWith(other vocab.Type) bool { } // AddIsExtendedBy returns true if the other provided type extends from the Add -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsAdd" variant instead. func AddIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -434,6 +435,15 @@ func DeserializeAdd(m map[string]interface{}, aliasMap map[string]string) (*Acti return this, nil } +// IsOrExtendsAdd returns true if the other provided type is the Add type or +// extends from the Add type. +func IsOrExtendsAdd(other vocab.Type) bool { + if other.GetTypeName() == "Add" { + return true + } + return this.AddIsExtendedBy(other) +} + // NewActivityStreamsAdd creates a new Add type func NewActivityStreamsAdd() *ActivityStreamsAdd { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_announce/gen_type_activitystreams_announce.go b/streams/impl/activitystreams/type_announce/gen_type_activitystreams_announce.go index c9195da..fb682af 100644 --- a/streams/impl/activitystreams/type_announce/gen_type_activitystreams_announce.go +++ b/streams/impl/activitystreams/type_announce/gen_type_activitystreams_announce.go @@ -94,7 +94,8 @@ func AnnounceIsDisjointWith(other vocab.Type) bool { } // AnnounceIsExtendedBy returns true if the other provided type extends from the -// Announce type. +// Announce type. Note that it returns false if the types are the same; see +// the "IsOrExtendsAnnounce" variant instead. func AnnounceIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -416,6 +417,15 @@ func DeserializeAnnounce(m map[string]interface{}, aliasMap map[string]string) ( return this, nil } +// IsOrExtendsAnnounce returns true if the other provided type is the Announce +// type or extends from the Announce type. +func IsOrExtendsAnnounce(other vocab.Type) bool { + if other.GetTypeName() == "Announce" { + return true + } + return this.AnnounceIsExtendedBy(other) +} + // NewActivityStreamsAnnounce creates a new Announce type func NewActivityStreamsAnnounce() *ActivityStreamsAnnounce { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_application/gen_type_activitystreams_application.go b/streams/impl/activitystreams/type_application/gen_type_activitystreams_application.go index e2f74d2..4a37eac 100644 --- a/streams/impl/activitystreams/type_application/gen_type_activitystreams_application.go +++ b/streams/impl/activitystreams/type_application/gen_type_activitystreams_application.go @@ -82,7 +82,8 @@ func ApplicationIsDisjointWith(other vocab.Type) bool { } // ApplicationIsExtendedBy returns true if the other provided type extends from -// the Application type. +// the Application type. Note that it returns false if the types are the same; +// see the "IsOrExtendsApplication" variant instead. func ApplicationIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -420,6 +421,15 @@ func DeserializeApplication(m map[string]interface{}, aliasMap map[string]string return this, nil } +// IsOrExtendsApplication returns true if the other provided type is the +// Application type or extends from the Application type. +func IsOrExtendsApplication(other vocab.Type) bool { + if other.GetTypeName() == "Application" { + return true + } + return this.ApplicationIsExtendedBy(other) +} + // NewActivityStreamsApplication creates a new Application type func NewActivityStreamsApplication() *ActivityStreamsApplication { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_arrive/gen_type_activitystreams_arrive.go b/streams/impl/activitystreams/type_arrive/gen_type_activitystreams_arrive.go index 7df6c81..88b1eed 100644 --- a/streams/impl/activitystreams/type_arrive/gen_type_activitystreams_arrive.go +++ b/streams/impl/activitystreams/type_arrive/gen_type_activitystreams_arrive.go @@ -93,7 +93,8 @@ func ArriveIsDisjointWith(other vocab.Type) bool { } // ArriveIsExtendedBy returns true if the other provided type extends from the -// Arrive type. +// Arrive type. Note that it returns false if the types are the same; see the +// "IsOrExtendsArrive" variant instead. func ArriveIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -408,6 +409,15 @@ func DeserializeArrive(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsArrive returns true if the other provided type is the Arrive type or +// extends from the Arrive type. +func IsOrExtendsArrive(other vocab.Type) bool { + if other.GetTypeName() == "Arrive" { + return true + } + return this.ArriveIsExtendedBy(other) +} + // NewActivityStreamsArrive creates a new Arrive type func NewActivityStreamsArrive() *ActivityStreamsArrive { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_article/gen_type_activitystreams_article.go b/streams/impl/activitystreams/type_article/gen_type_activitystreams_article.go index 679c008..5c366ef 100644 --- a/streams/impl/activitystreams/type_article/gen_type_activitystreams_article.go +++ b/streams/impl/activitystreams/type_article/gen_type_activitystreams_article.go @@ -78,7 +78,8 @@ func ArticleIsDisjointWith(other vocab.Type) bool { } // ArticleIsExtendedBy returns true if the other provided type extends from the -// Article type. +// Article type. Note that it returns false if the types are the same; see the +// "IsOrExtendsArticle" variant instead. func ArticleIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -365,6 +366,15 @@ func DeserializeArticle(m map[string]interface{}, aliasMap map[string]string) (* return this, nil } +// IsOrExtendsArticle returns true if the other provided type is the Article type +// or extends from the Article type. +func IsOrExtendsArticle(other vocab.Type) bool { + if other.GetTypeName() == "Article" { + return true + } + return this.ArticleIsExtendedBy(other) +} + // NewActivityStreamsArticle creates a new Article type func NewActivityStreamsArticle() *ActivityStreamsArticle { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_audio/gen_type_activitystreams_audio.go b/streams/impl/activitystreams/type_audio/gen_type_activitystreams_audio.go index 84e3671..02ac2cf 100644 --- a/streams/impl/activitystreams/type_audio/gen_type_activitystreams_audio.go +++ b/streams/impl/activitystreams/type_audio/gen_type_activitystreams_audio.go @@ -80,7 +80,8 @@ func AudioIsDisjointWith(other vocab.Type) bool { } // AudioIsExtendedBy returns true if the other provided type extends from the -// Audio type. +// Audio type. Note that it returns false if the types are the same; see the +// "IsOrExtendsAudio" variant instead. func AudioIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -367,6 +368,15 @@ func DeserializeAudio(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsAudio returns true if the other provided type is the Audio type or +// extends from the Audio type. +func IsOrExtendsAudio(other vocab.Type) bool { + if other.GetTypeName() == "Audio" { + return true + } + return this.AudioIsExtendedBy(other) +} + // NewActivityStreamsAudio creates a new Audio type func NewActivityStreamsAudio() *ActivityStreamsAudio { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_block/gen_type_activitystreams_block.go b/streams/impl/activitystreams/type_block/gen_type_activitystreams_block.go index e981590..b8fc583 100644 --- a/streams/impl/activitystreams/type_block/gen_type_activitystreams_block.go +++ b/streams/impl/activitystreams/type_block/gen_type_activitystreams_block.go @@ -85,7 +85,8 @@ func BlockIsDisjointWith(other vocab.Type) bool { } // BlockIsExtendedBy returns true if the other provided type extends from the -// Block type. +// Block type. Note that it returns false if the types are the same; see the +// "IsOrExtendsBlock" variant instead. func BlockIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -407,6 +408,15 @@ func DeserializeBlock(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsBlock returns true if the other provided type is the Block type or +// extends from the Block type. +func IsOrExtendsBlock(other vocab.Type) bool { + if other.GetTypeName() == "Block" { + return true + } + return this.BlockIsExtendedBy(other) +} + // NewActivityStreamsBlock creates a new Block type func NewActivityStreamsBlock() *ActivityStreamsBlock { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_collection/gen_type_activitystreams_collection.go b/streams/impl/activitystreams/type_collection/gen_type_activitystreams_collection.go index a32379f..26d2fa4 100644 --- a/streams/impl/activitystreams/type_collection/gen_type_activitystreams_collection.go +++ b/streams/impl/activitystreams/type_collection/gen_type_activitystreams_collection.go @@ -93,7 +93,8 @@ func CollectionIsDisjointWith(other vocab.Type) bool { } // CollectionIsExtendedBy returns true if the other provided type extends from the -// Collection type. +// Collection type. Note that it returns false if the types are the same; see +// the "IsOrExtendsCollection" variant instead. func CollectionIsExtendedBy(other vocab.Type) bool { extensions := []string{"CollectionPage", "OrderedCollection", "OrderedCollectionPage", "OrderedCollectionPage"} for _, ext := range extensions { @@ -420,6 +421,15 @@ func DeserializeCollection(m map[string]interface{}, aliasMap map[string]string) return this, nil } +// IsOrExtendsCollection returns true if the other provided type is the Collection +// type or extends from the Collection type. +func IsOrExtendsCollection(other vocab.Type) bool { + if other.GetTypeName() == "Collection" { + return true + } + return this.CollectionIsExtendedBy(other) +} + // NewActivityStreamsCollection creates a new Collection type func NewActivityStreamsCollection() *ActivityStreamsCollection { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_collectionpage/gen_type_activitystreams_collectionpage.go b/streams/impl/activitystreams/type_collectionpage/gen_type_activitystreams_collectionpage.go index aeb57a9..e7ab478 100644 --- a/streams/impl/activitystreams/type_collectionpage/gen_type_activitystreams_collectionpage.go +++ b/streams/impl/activitystreams/type_collectionpage/gen_type_activitystreams_collectionpage.go @@ -97,7 +97,8 @@ func CollectionPageIsDisjointWith(other vocab.Type) bool { } // CollectionPageIsExtendedBy returns true if the other provided type extends from -// the CollectionPage type. +// the CollectionPage type. Note that it returns false if the types are the +// same; see the "IsOrExtendsCollectionPage" variant instead. func CollectionPageIsExtendedBy(other vocab.Type) bool { extensions := []string{"OrderedCollectionPage"} for _, ext := range extensions { @@ -445,6 +446,15 @@ func DeserializeCollectionPage(m map[string]interface{}, aliasMap map[string]str return this, nil } +// IsOrExtendsCollectionPage returns true if the other provided type is the +// CollectionPage type or extends from the CollectionPage type. +func IsOrExtendsCollectionPage(other vocab.Type) bool { + if other.GetTypeName() == "CollectionPage" { + return true + } + return this.CollectionPageIsExtendedBy(other) +} + // NewActivityStreamsCollectionPage creates a new CollectionPage type func NewActivityStreamsCollectionPage() *ActivityStreamsCollectionPage { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_create/gen_type_activitystreams_create.go b/streams/impl/activitystreams/type_create/gen_type_activitystreams_create.go index a66fa8b..9ca12bb 100644 --- a/streams/impl/activitystreams/type_create/gen_type_activitystreams_create.go +++ b/streams/impl/activitystreams/type_create/gen_type_activitystreams_create.go @@ -89,7 +89,8 @@ func CreateIsDisjointWith(other vocab.Type) bool { } // CreateIsExtendedBy returns true if the other provided type extends from the -// Create type. +// Create type. Note that it returns false if the types are the same; see the +// "IsOrExtendsCreate" variant instead. func CreateIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -411,6 +412,15 @@ func DeserializeCreate(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsCreate returns true if the other provided type is the Create type or +// extends from the Create type. +func IsOrExtendsCreate(other vocab.Type) bool { + if other.GetTypeName() == "Create" { + return true + } + return this.CreateIsExtendedBy(other) +} + // NewActivityStreamsCreate creates a new Create type func NewActivityStreamsCreate() *ActivityStreamsCreate { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_delete/gen_type_activitystreams_delete.go b/streams/impl/activitystreams/type_delete/gen_type_activitystreams_delete.go index cd9dc83..f2791d9 100644 --- a/streams/impl/activitystreams/type_delete/gen_type_activitystreams_delete.go +++ b/streams/impl/activitystreams/type_delete/gen_type_activitystreams_delete.go @@ -90,7 +90,8 @@ func DeleteIsDisjointWith(other vocab.Type) bool { } // DeleteIsExtendedBy returns true if the other provided type extends from the -// Delete type. +// Delete type. Note that it returns false if the types are the same; see the +// "IsOrExtendsDelete" variant instead. func DeleteIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false @@ -412,6 +413,15 @@ func DeserializeDelete(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsDelete returns true if the other provided type is the Delete type or +// extends from the Delete type. +func IsOrExtendsDelete(other vocab.Type) bool { + if other.GetTypeName() == "Delete" { + return true + } + return this.DeleteIsExtendedBy(other) +} + // NewActivityStreamsDelete creates a new Delete type func NewActivityStreamsDelete() *ActivityStreamsDelete { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_dislike/gen_type_activitystreams_dislike.go b/streams/impl/activitystreams/type_dislike/gen_type_activitystreams_dislike.go index 532b247..2bbaaa5 100644 --- a/streams/impl/activitystreams/type_dislike/gen_type_activitystreams_dislike.go +++ b/streams/impl/activitystreams/type_dislike/gen_type_activitystreams_dislike.go @@ -398,12 +398,22 @@ func DislikeIsDisjointWith(other vocab.Type) bool { } // DislikeIsExtendedBy returns true if the other provided type extends from the -// Dislike type. +// Dislike type. Note that it returns false if the types are the same; see the +// "IsOrExtendsDislike" variant instead. func DislikeIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsDislike returns true if the other provided type is the Dislike type +// or extends from the Dislike type. +func IsOrExtendsDislike(other vocab.Type) bool { + if other.GetTypeName() == "Dislike" { + return true + } + return this.DislikeIsExtendedBy(other) +} + // NewActivityStreamsDislike creates a new Dislike type func NewActivityStreamsDislike() *ActivityStreamsDislike { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_document/gen_type_activitystreams_document.go b/streams/impl/activitystreams/type_document/gen_type_activitystreams_document.go index 1438e82..8aeb679 100644 --- a/streams/impl/activitystreams/type_document/gen_type_activitystreams_document.go +++ b/streams/impl/activitystreams/type_document/gen_type_activitystreams_document.go @@ -357,7 +357,8 @@ func DocumentIsDisjointWith(other vocab.Type) bool { } // DocumentIsExtendedBy returns true if the other provided type extends from the -// Document type. +// Document type. Note that it returns false if the types are the same; see +// the "IsOrExtendsDocument" variant instead. func DocumentIsExtendedBy(other vocab.Type) bool { extensions := []string{"Audio", "Image", "Page", "Video"} for _, ext := range extensions { @@ -368,6 +369,15 @@ func DocumentIsExtendedBy(other vocab.Type) bool { return false } +// IsOrExtendsDocument returns true if the other provided type is the Document +// type or extends from the Document type. +func IsOrExtendsDocument(other vocab.Type) bool { + if other.GetTypeName() == "Document" { + return true + } + return this.DocumentIsExtendedBy(other) +} + // NewActivityStreamsDocument creates a new Document type func NewActivityStreamsDocument() *ActivityStreamsDocument { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_event/gen_type_activitystreams_event.go b/streams/impl/activitystreams/type_event/gen_type_activitystreams_event.go index cce16d1..1444f00 100644 --- a/streams/impl/activitystreams/type_event/gen_type_activitystreams_event.go +++ b/streams/impl/activitystreams/type_event/gen_type_activitystreams_event.go @@ -358,12 +358,22 @@ func EventIsDisjointWith(other vocab.Type) bool { } // EventIsExtendedBy returns true if the other provided type extends from the -// Event type. +// Event type. Note that it returns false if the types are the same; see the +// "IsOrExtendsEvent" variant instead. func EventIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsEvent returns true if the other provided type is the Event type or +// extends from the Event type. +func IsOrExtendsEvent(other vocab.Type) bool { + if other.GetTypeName() == "Event" { + return true + } + return this.EventIsExtendedBy(other) +} + // NewActivityStreamsEvent creates a new Event type func NewActivityStreamsEvent() *ActivityStreamsEvent { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_flag/gen_type_activitystreams_flag.go b/streams/impl/activitystreams/type_flag/gen_type_activitystreams_flag.go index 5fa7b2a..ee0d2e3 100644 --- a/streams/impl/activitystreams/type_flag/gen_type_activitystreams_flag.go +++ b/streams/impl/activitystreams/type_flag/gen_type_activitystreams_flag.go @@ -403,12 +403,22 @@ func FlagIsDisjointWith(other vocab.Type) bool { } // FlagIsExtendedBy returns true if the other provided type extends from the Flag -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsFlag" variant instead. func FlagIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsFlag returns true if the other provided type is the Flag type or +// extends from the Flag type. +func IsOrExtendsFlag(other vocab.Type) bool { + if other.GetTypeName() == "Flag" { + return true + } + return this.FlagIsExtendedBy(other) +} + // NewActivityStreamsFlag creates a new Flag type func NewActivityStreamsFlag() *ActivityStreamsFlag { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_follow/gen_type_activitystreams_follow.go b/streams/impl/activitystreams/type_follow/gen_type_activitystreams_follow.go index 7c0c123..d804aec 100644 --- a/streams/impl/activitystreams/type_follow/gen_type_activitystreams_follow.go +++ b/streams/impl/activitystreams/type_follow/gen_type_activitystreams_follow.go @@ -407,12 +407,22 @@ func FollowIsDisjointWith(other vocab.Type) bool { } // FollowIsExtendedBy returns true if the other provided type extends from the -// Follow type. +// Follow type. Note that it returns false if the types are the same; see the +// "IsOrExtendsFollow" variant instead. func FollowIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsFollow returns true if the other provided type is the Follow type or +// extends from the Follow type. +func IsOrExtendsFollow(other vocab.Type) bool { + if other.GetTypeName() == "Follow" { + return true + } + return this.FollowIsExtendedBy(other) +} + // NewActivityStreamsFollow creates a new Follow type func NewActivityStreamsFollow() *ActivityStreamsFollow { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_group/gen_type_activitystreams_group.go b/streams/impl/activitystreams/type_group/gen_type_activitystreams_group.go index 58123f1..df471fc 100644 --- a/streams/impl/activitystreams/type_group/gen_type_activitystreams_group.go +++ b/streams/impl/activitystreams/type_group/gen_type_activitystreams_group.go @@ -414,12 +414,22 @@ func GroupIsDisjointWith(other vocab.Type) bool { } // GroupIsExtendedBy returns true if the other provided type extends from the -// Group type. +// Group type. Note that it returns false if the types are the same; see the +// "IsOrExtendsGroup" variant instead. func GroupIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsGroup returns true if the other provided type is the Group type or +// extends from the Group type. +func IsOrExtendsGroup(other vocab.Type) bool { + if other.GetTypeName() == "Group" { + return true + } + return this.GroupIsExtendedBy(other) +} + // NewActivityStreamsGroup creates a new Group type func NewActivityStreamsGroup() *ActivityStreamsGroup { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_ignore/gen_type_activitystreams_ignore.go b/streams/impl/activitystreams/type_ignore/gen_type_activitystreams_ignore.go index 2b08d09..8c72f16 100644 --- a/streams/impl/activitystreams/type_ignore/gen_type_activitystreams_ignore.go +++ b/streams/impl/activitystreams/type_ignore/gen_type_activitystreams_ignore.go @@ -402,7 +402,8 @@ func IgnoreIsDisjointWith(other vocab.Type) bool { } // IgnoreIsExtendedBy returns true if the other provided type extends from the -// Ignore type. +// Ignore type. Note that it returns false if the types are the same; see the +// "IsOrExtendsIgnore" variant instead. func IgnoreIsExtendedBy(other vocab.Type) bool { extensions := []string{"Block"} for _, ext := range extensions { @@ -413,6 +414,15 @@ func IgnoreIsExtendedBy(other vocab.Type) bool { return false } +// IsOrExtendsIgnore returns true if the other provided type is the Ignore type or +// extends from the Ignore type. +func IsOrExtendsIgnore(other vocab.Type) bool { + if other.GetTypeName() == "Ignore" { + return true + } + return this.IgnoreIsExtendedBy(other) +} + // NewActivityStreamsIgnore creates a new Ignore type func NewActivityStreamsIgnore() *ActivityStreamsIgnore { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_image/gen_type_activitystreams_image.go b/streams/impl/activitystreams/type_image/gen_type_activitystreams_image.go index 548d9ef..3af99e4 100644 --- a/streams/impl/activitystreams/type_image/gen_type_activitystreams_image.go +++ b/streams/impl/activitystreams/type_image/gen_type_activitystreams_image.go @@ -384,12 +384,22 @@ func ImageIsDisjointWith(other vocab.Type) bool { } // ImageIsExtendedBy returns true if the other provided type extends from the -// Image type. +// Image type. Note that it returns false if the types are the same; see the +// "IsOrExtendsImage" variant instead. func ImageIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsImage returns true if the other provided type is the Image type or +// extends from the Image type. +func IsOrExtendsImage(other vocab.Type) bool { + if other.GetTypeName() == "Image" { + return true + } + return this.ImageIsExtendedBy(other) +} + // NewActivityStreamsImage creates a new Image type func NewActivityStreamsImage() *ActivityStreamsImage { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_intransitiveactivity/gen_type_activitystreams_intransitiveactivity.go b/streams/impl/activitystreams/type_intransitiveactivity/gen_type_activitystreams_intransitiveactivity.go index 8117684..b6769cc 100644 --- a/streams/impl/activitystreams/type_intransitiveactivity/gen_type_activitystreams_intransitiveactivity.go +++ b/streams/impl/activitystreams/type_intransitiveactivity/gen_type_activitystreams_intransitiveactivity.go @@ -398,7 +398,9 @@ func IntransitiveActivityIsDisjointWith(other vocab.Type) bool { } // IntransitiveActivityIsExtendedBy returns true if the other provided type -// extends from the IntransitiveActivity type. +// extends from the IntransitiveActivity type. Note that it returns false if +// the types are the same; see the "IsOrExtendsIntransitiveActivity" variant +// instead. func IntransitiveActivityIsExtendedBy(other vocab.Type) bool { extensions := []string{"Arrive", "Question", "Travel"} for _, ext := range extensions { @@ -409,6 +411,15 @@ func IntransitiveActivityIsExtendedBy(other vocab.Type) bool { return false } +// IsOrExtendsIntransitiveActivity returns true if the other provided type is the +// IntransitiveActivity type or extends from the IntransitiveActivity type. +func IsOrExtendsIntransitiveActivity(other vocab.Type) bool { + if other.GetTypeName() == "IntransitiveActivity" { + return true + } + return this.IntransitiveActivityIsExtendedBy(other) +} + // NewActivityStreamsIntransitiveActivity creates a new IntransitiveActivity type func NewActivityStreamsIntransitiveActivity() *ActivityStreamsIntransitiveActivity { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_invite/gen_type_activitystreams_invite.go b/streams/impl/activitystreams/type_invite/gen_type_activitystreams_invite.go index bd72d33..2d7dd5a 100644 --- a/streams/impl/activitystreams/type_invite/gen_type_activitystreams_invite.go +++ b/streams/impl/activitystreams/type_invite/gen_type_activitystreams_invite.go @@ -415,12 +415,22 @@ func InviteIsDisjointWith(other vocab.Type) bool { } // InviteIsExtendedBy returns true if the other provided type extends from the -// Invite type. +// Invite type. Note that it returns false if the types are the same; see the +// "IsOrExtendsInvite" variant instead. func InviteIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false } +// IsOrExtendsInvite returns true if the other provided type is the Invite type or +// extends from the Invite type. +func IsOrExtendsInvite(other vocab.Type) bool { + if other.GetTypeName() == "Invite" { + return true + } + return this.InviteIsExtendedBy(other) +} + // NewActivityStreamsInvite creates a new Invite type func NewActivityStreamsInvite() *ActivityStreamsInvite { typeProp := typePropertyConstructor() diff --git a/streams/impl/activitystreams/type_join/gen_type_activitystreams_join.go b/streams/impl/activitystreams/type_join/gen_type_activitystreams_join.go index a6244f6..1bc9723 100644 --- a/streams/impl/activitystreams/type_join/gen_type_activitystreams_join.go +++ b/streams/impl/activitystreams/type_join/gen_type_activitystreams_join.go @@ -392,6 +392,15 @@ func DeserializeJoin(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsJoin returns true if the other provided type is the Join type or +// extends from the Join type. +func IsOrExtendsJoin(other vocab.Type) bool { + if other.GetTypeName() == "Join" { + return true + } + return this.JoinIsExtendedBy(other) +} + // JoinIsDisjointWith returns true if the other provided type is disjoint with the // Join type. func JoinIsDisjointWith(other vocab.Type) bool { @@ -405,7 +414,8 @@ func JoinIsDisjointWith(other vocab.Type) bool { } // JoinIsExtendedBy returns true if the other provided type extends from the Join -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsJoin" variant instead. func JoinIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_leave/gen_type_activitystreams_leave.go b/streams/impl/activitystreams/type_leave/gen_type_activitystreams_leave.go index bb0b2dd..18109cc 100644 --- a/streams/impl/activitystreams/type_leave/gen_type_activitystreams_leave.go +++ b/streams/impl/activitystreams/type_leave/gen_type_activitystreams_leave.go @@ -406,6 +406,15 @@ func DeserializeLeave(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsLeave returns true if the other provided type is the Leave type or +// extends from the Leave type. +func IsOrExtendsLeave(other vocab.Type) bool { + if other.GetTypeName() == "Leave" { + return true + } + return this.LeaveIsExtendedBy(other) +} + // LeaveIsDisjointWith returns true if the other provided type is disjoint with // the Leave type. func LeaveIsDisjointWith(other vocab.Type) bool { @@ -419,7 +428,8 @@ func LeaveIsDisjointWith(other vocab.Type) bool { } // LeaveIsExtendedBy returns true if the other provided type extends from the -// Leave type. +// Leave type. Note that it returns false if the types are the same; see the +// "IsOrExtendsLeave" variant instead. func LeaveIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_like/gen_type_activitystreams_like.go b/streams/impl/activitystreams/type_like/gen_type_activitystreams_like.go index e38d874..e7b26be 100644 --- a/streams/impl/activitystreams/type_like/gen_type_activitystreams_like.go +++ b/streams/impl/activitystreams/type_like/gen_type_activitystreams_like.go @@ -389,6 +389,15 @@ func DeserializeLike(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsLike returns true if the other provided type is the Like type or +// extends from the Like type. +func IsOrExtendsLike(other vocab.Type) bool { + if other.GetTypeName() == "Like" { + return true + } + return this.LikeIsExtendedBy(other) +} + // LikeIsDisjointWith returns true if the other provided type is disjoint with the // Like type. func LikeIsDisjointWith(other vocab.Type) bool { @@ -402,7 +411,8 @@ func LikeIsDisjointWith(other vocab.Type) bool { } // LikeIsExtendedBy returns true if the other provided type extends from the Like -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsLike" variant instead. func LikeIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_link/gen_type_activitystreams_link.go b/streams/impl/activitystreams/type_link/gen_type_activitystreams_link.go index 2183ab4..c4cb118 100644 --- a/streams/impl/activitystreams/type_link/gen_type_activitystreams_link.go +++ b/streams/impl/activitystreams/type_link/gen_type_activitystreams_link.go @@ -185,6 +185,15 @@ func DeserializeLink(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsLink returns true if the other provided type is the Link type or +// extends from the Link type. +func IsOrExtendsLink(other vocab.Type) bool { + if other.GetTypeName() == "Link" { + return true + } + return this.LinkIsExtendedBy(other) +} + // LinkIsDisjointWith returns true if the other provided type is disjoint with the // Link type. func LinkIsDisjointWith(other vocab.Type) bool { @@ -198,7 +207,8 @@ func LinkIsDisjointWith(other vocab.Type) bool { } // LinkIsExtendedBy returns true if the other provided type extends from the Link -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsLink" variant instead. func LinkIsExtendedBy(other vocab.Type) bool { extensions := []string{"Mention"} for _, ext := range extensions { diff --git a/streams/impl/activitystreams/type_listen/gen_type_activitystreams_listen.go b/streams/impl/activitystreams/type_listen/gen_type_activitystreams_listen.go index 49f5688..0f1ba39 100644 --- a/streams/impl/activitystreams/type_listen/gen_type_activitystreams_listen.go +++ b/streams/impl/activitystreams/type_listen/gen_type_activitystreams_listen.go @@ -388,6 +388,15 @@ func DeserializeListen(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsListen returns true if the other provided type is the Listen type or +// extends from the Listen type. +func IsOrExtendsListen(other vocab.Type) bool { + if other.GetTypeName() == "Listen" { + return true + } + return this.ListenIsExtendedBy(other) +} + // ListenIsDisjointWith returns true if the other provided type is disjoint with // the Listen type. func ListenIsDisjointWith(other vocab.Type) bool { @@ -401,7 +410,8 @@ func ListenIsDisjointWith(other vocab.Type) bool { } // ListenIsExtendedBy returns true if the other provided type extends from the -// Listen type. +// Listen type. Note that it returns false if the types are the same; see the +// "IsOrExtendsListen" variant instead. func ListenIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_mention/gen_type_activitystreams_mention.go b/streams/impl/activitystreams/type_mention/gen_type_activitystreams_mention.go index 778b240..b401f47 100644 --- a/streams/impl/activitystreams/type_mention/gen_type_activitystreams_mention.go +++ b/streams/impl/activitystreams/type_mention/gen_type_activitystreams_mention.go @@ -183,6 +183,15 @@ func DeserializeMention(m map[string]interface{}, aliasMap map[string]string) (* return this, nil } +// IsOrExtendsMention returns true if the other provided type is the Mention type +// or extends from the Mention type. +func IsOrExtendsMention(other vocab.Type) bool { + if other.GetTypeName() == "Mention" { + return true + } + return this.MentionIsExtendedBy(other) +} + // MentionIsDisjointWith returns true if the other provided type is disjoint with // the Mention type. func MentionIsDisjointWith(other vocab.Type) bool { @@ -196,7 +205,8 @@ func MentionIsDisjointWith(other vocab.Type) bool { } // MentionIsExtendedBy returns true if the other provided type extends from the -// Mention type. +// Mention type. Note that it returns false if the types are the same; see the +// "IsOrExtendsMention" variant instead. func MentionIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_move/gen_type_activitystreams_move.go b/streams/impl/activitystreams/type_move/gen_type_activitystreams_move.go index 1e82a5c..4e689d6 100644 --- a/streams/impl/activitystreams/type_move/gen_type_activitystreams_move.go +++ b/streams/impl/activitystreams/type_move/gen_type_activitystreams_move.go @@ -397,6 +397,15 @@ func DeserializeMove(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsMove returns true if the other provided type is the Move type or +// extends from the Move type. +func IsOrExtendsMove(other vocab.Type) bool { + if other.GetTypeName() == "Move" { + return true + } + return this.MoveIsExtendedBy(other) +} + // MoveIsDisjointWith returns true if the other provided type is disjoint with the // Move type. func MoveIsDisjointWith(other vocab.Type) bool { @@ -410,7 +419,8 @@ func MoveIsDisjointWith(other vocab.Type) bool { } // MoveIsExtendedBy returns true if the other provided type extends from the Move -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsMove" variant instead. func MoveIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_note/gen_type_activitystreams_note.go b/streams/impl/activitystreams/type_note/gen_type_activitystreams_note.go index dcea124..d9cea7f 100644 --- a/streams/impl/activitystreams/type_note/gen_type_activitystreams_note.go +++ b/streams/impl/activitystreams/type_note/gen_type_activitystreams_note.go @@ -345,6 +345,15 @@ func DeserializeNote(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsNote returns true if the other provided type is the Note type or +// extends from the Note type. +func IsOrExtendsNote(other vocab.Type) bool { + if other.GetTypeName() == "Note" { + return true + } + return this.NoteIsExtendedBy(other) +} + // NewActivityStreamsNote creates a new Note type func NewActivityStreamsNote() *ActivityStreamsNote { typeProp := typePropertyConstructor() @@ -369,7 +378,8 @@ func NoteIsDisjointWith(other vocab.Type) bool { } // NoteIsExtendedBy returns true if the other provided type extends from the Note -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsNote" variant instead. func NoteIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_object/gen_type_activitystreams_object.go b/streams/impl/activitystreams/type_object/gen_type_activitystreams_object.go index afa72e1..271e2e0 100644 --- a/streams/impl/activitystreams/type_object/gen_type_activitystreams_object.go +++ b/streams/impl/activitystreams/type_object/gen_type_activitystreams_object.go @@ -342,6 +342,15 @@ func DeserializeObject(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsObject returns true if the other provided type is the Object type or +// extends from the Object type. +func IsOrExtendsObject(other vocab.Type) bool { + if other.GetTypeName() == "Object" { + return true + } + return this.ObjectIsExtendedBy(other) +} + // NewActivityStreamsObject creates a new Object type func NewActivityStreamsObject() *ActivityStreamsObject { typeProp := typePropertyConstructor() @@ -366,7 +375,8 @@ func ObjectIsDisjointWith(other vocab.Type) bool { } // ObjectIsExtendedBy returns true if the other provided type extends from the -// Object type. +// Object type. Note that it returns false if the types are the same; see the +// "IsOrExtendsObject" variant instead. func ObjectIsExtendedBy(other vocab.Type) bool { extensions := []string{"Accept", "Activity", "Add", "Announce", "Application", "Arrive", "Article", "Audio", "Block", "Collection", "CollectionPage", "Create", "Delete", "Dislike", "Document", "Event", "Flag", "Follow", "Group", "Ignore", "Image", "IntransitiveActivity", "Invite", "Join", "Leave", "Like", "Listen", "Move", "Note", "Offer", "OrderedCollection", "OrderedCollectionPage", "OrderedCollectionPage", "Organization", "Page", "Person", "Place", "Profile", "Question", "Read", "Reject", "Relationship", "Remove", "Service", "TentativeAccept", "TentativeReject", "Tombstone", "Travel", "Undo", "Update", "Video", "View"} for _, ext := range extensions { diff --git a/streams/impl/activitystreams/type_offer/gen_type_activitystreams_offer.go b/streams/impl/activitystreams/type_offer/gen_type_activitystreams_offer.go index c6600ab..d3f8741 100644 --- a/streams/impl/activitystreams/type_offer/gen_type_activitystreams_offer.go +++ b/streams/impl/activitystreams/type_offer/gen_type_activitystreams_offer.go @@ -396,6 +396,15 @@ func DeserializeOffer(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsOffer returns true if the other provided type is the Offer type or +// extends from the Offer type. +func IsOrExtendsOffer(other vocab.Type) bool { + if other.GetTypeName() == "Offer" { + return true + } + return this.OfferIsExtendedBy(other) +} + // NewActivityStreamsOffer creates a new Offer type func NewActivityStreamsOffer() *ActivityStreamsOffer { typeProp := typePropertyConstructor() @@ -420,7 +429,8 @@ func OfferIsDisjointWith(other vocab.Type) bool { } // OfferIsExtendedBy returns true if the other provided type extends from the -// Offer type. +// Offer type. Note that it returns false if the types are the same; see the +// "IsOrExtendsOffer" variant instead. func OfferIsExtendedBy(other vocab.Type) bool { extensions := []string{"Invite"} for _, ext := range extensions { diff --git a/streams/impl/activitystreams/type_orderedcollection/gen_type_activitystreams_orderedcollection.go b/streams/impl/activitystreams/type_orderedcollection/gen_type_activitystreams_orderedcollection.go index d2b76e8..69833d7 100644 --- a/streams/impl/activitystreams/type_orderedcollection/gen_type_activitystreams_orderedcollection.go +++ b/streams/impl/activitystreams/type_orderedcollection/gen_type_activitystreams_orderedcollection.go @@ -395,6 +395,15 @@ func DeserializeOrderedCollection(m map[string]interface{}, aliasMap map[string] return this, nil } +// IsOrExtendsOrderedCollection returns true if the other provided type is the +// OrderedCollection type or extends from the OrderedCollection type. +func IsOrExtendsOrderedCollection(other vocab.Type) bool { + if other.GetTypeName() == "OrderedCollection" { + return true + } + return this.OrderedCollectionIsExtendedBy(other) +} + // NewActivityStreamsOrderedCollection creates a new OrderedCollection type func NewActivityStreamsOrderedCollection() *ActivityStreamsOrderedCollection { typeProp := typePropertyConstructor() @@ -419,7 +428,8 @@ func OrderedCollectionIsDisjointWith(other vocab.Type) bool { } // OrderedCollectionIsExtendedBy returns true if the other provided type extends -// from the OrderedCollection type. +// from the OrderedCollection type. Note that it returns false if the types +// are the same; see the "IsOrExtendsOrderedCollection" variant instead. func OrderedCollectionIsExtendedBy(other vocab.Type) bool { extensions := []string{"OrderedCollectionPage"} for _, ext := range extensions { diff --git a/streams/impl/activitystreams/type_orderedcollectionpage/gen_type_activitystreams_orderedcollectionpage.go b/streams/impl/activitystreams/type_orderedcollectionpage/gen_type_activitystreams_orderedcollectionpage.go index 255c698..69877bf 100644 --- a/streams/impl/activitystreams/type_orderedcollectionpage/gen_type_activitystreams_orderedcollectionpage.go +++ b/streams/impl/activitystreams/type_orderedcollectionpage/gen_type_activitystreams_orderedcollectionpage.go @@ -429,6 +429,15 @@ func DeserializeOrderedCollectionPage(m map[string]interface{}, aliasMap map[str return this, nil } +// IsOrExtendsOrderedCollectionPage returns true if the other provided type is the +// OrderedCollectionPage type or extends from the OrderedCollectionPage type. +func IsOrExtendsOrderedCollectionPage(other vocab.Type) bool { + if other.GetTypeName() == "OrderedCollectionPage" { + return true + } + return this.OrderedCollectionPageIsExtendedBy(other) +} + // NewActivityStreamsOrderedCollectionPage creates a new OrderedCollectionPage type func NewActivityStreamsOrderedCollectionPage() *ActivityStreamsOrderedCollectionPage { typeProp := typePropertyConstructor() @@ -453,7 +462,9 @@ func OrderedCollectionPageIsDisjointWith(other vocab.Type) bool { } // OrderedCollectionPageIsExtendedBy returns true if the other provided type -// extends from the OrderedCollectionPage type. +// extends from the OrderedCollectionPage type. Note that it returns false if +// the types are the same; see the "IsOrExtendsOrderedCollectionPage" variant +// instead. func OrderedCollectionPageIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_organization/gen_type_activitystreams_organization.go b/streams/impl/activitystreams/type_organization/gen_type_activitystreams_organization.go index 3fa6af7..fbb8fdd 100644 --- a/streams/impl/activitystreams/type_organization/gen_type_activitystreams_organization.go +++ b/streams/impl/activitystreams/type_organization/gen_type_activitystreams_organization.go @@ -401,6 +401,15 @@ func DeserializeOrganization(m map[string]interface{}, aliasMap map[string]strin return this, nil } +// IsOrExtendsOrganization returns true if the other provided type is the +// Organization type or extends from the Organization type. +func IsOrExtendsOrganization(other vocab.Type) bool { + if other.GetTypeName() == "Organization" { + return true + } + return this.OrganizationIsExtendedBy(other) +} + // NewActivityStreamsOrganization creates a new Organization type func NewActivityStreamsOrganization() *ActivityStreamsOrganization { typeProp := typePropertyConstructor() @@ -425,7 +434,8 @@ func OrganizationIsDisjointWith(other vocab.Type) bool { } // OrganizationIsExtendedBy returns true if the other provided type extends from -// the Organization type. +// the Organization type. Note that it returns false if the types are the +// same; see the "IsOrExtendsOrganization" variant instead. func OrganizationIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_page/gen_type_activitystreams_page.go b/streams/impl/activitystreams/type_page/gen_type_activitystreams_page.go index 0501ae8..e3529b7 100644 --- a/streams/impl/activitystreams/type_page/gen_type_activitystreams_page.go +++ b/streams/impl/activitystreams/type_page/gen_type_activitystreams_page.go @@ -344,6 +344,15 @@ func DeserializePage(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsPage returns true if the other provided type is the Page type or +// extends from the Page type. +func IsOrExtendsPage(other vocab.Type) bool { + if other.GetTypeName() == "Page" { + return true + } + return this.PageIsExtendedBy(other) +} + // NewActivityStreamsPage creates a new Page type func NewActivityStreamsPage() *ActivityStreamsPage { typeProp := typePropertyConstructor() @@ -368,7 +377,8 @@ func PageIsDisjointWith(other vocab.Type) bool { } // PageIsExtendedBy returns true if the other provided type extends from the Page -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsPage" variant instead. func PageIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_person/gen_type_activitystreams_person.go b/streams/impl/activitystreams/type_person/gen_type_activitystreams_person.go index cd991c1..9a37276 100644 --- a/streams/impl/activitystreams/type_person/gen_type_activitystreams_person.go +++ b/streams/impl/activitystreams/type_person/gen_type_activitystreams_person.go @@ -401,6 +401,15 @@ func DeserializePerson(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsPerson returns true if the other provided type is the Person type or +// extends from the Person type. +func IsOrExtendsPerson(other vocab.Type) bool { + if other.GetTypeName() == "Person" { + return true + } + return this.PersonIsExtendedBy(other) +} + // NewActivityStreamsPerson creates a new Person type func NewActivityStreamsPerson() *ActivityStreamsPerson { typeProp := typePropertyConstructor() @@ -425,7 +434,8 @@ func PersonIsDisjointWith(other vocab.Type) bool { } // PersonIsExtendedBy returns true if the other provided type extends from the -// Person type. +// Person type. Note that it returns false if the types are the same; see the +// "IsOrExtendsPerson" variant instead. func PersonIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_place/gen_type_activitystreams_place.go b/streams/impl/activitystreams/type_place/gen_type_activitystreams_place.go index 4678aff..a7a49d2 100644 --- a/streams/impl/activitystreams/type_place/gen_type_activitystreams_place.go +++ b/streams/impl/activitystreams/type_place/gen_type_activitystreams_place.go @@ -394,6 +394,15 @@ func DeserializePlace(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsPlace returns true if the other provided type is the Place type or +// extends from the Place type. +func IsOrExtendsPlace(other vocab.Type) bool { + if other.GetTypeName() == "Place" { + return true + } + return this.PlaceIsExtendedBy(other) +} + // NewActivityStreamsPlace creates a new Place type func NewActivityStreamsPlace() *ActivityStreamsPlace { typeProp := typePropertyConstructor() @@ -418,7 +427,8 @@ func PlaceIsDisjointWith(other vocab.Type) bool { } // PlaceIsExtendedBy returns true if the other provided type extends from the -// Place type. +// Place type. Note that it returns false if the types are the same; see the +// "IsOrExtendsPlace" variant instead. func PlaceIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_profile/gen_type_activitystreams_profile.go b/streams/impl/activitystreams/type_profile/gen_type_activitystreams_profile.go index bae73f7..79b781d 100644 --- a/streams/impl/activitystreams/type_profile/gen_type_activitystreams_profile.go +++ b/streams/impl/activitystreams/type_profile/gen_type_activitystreams_profile.go @@ -357,6 +357,15 @@ func DeserializeProfile(m map[string]interface{}, aliasMap map[string]string) (* return this, nil } +// IsOrExtendsProfile returns true if the other provided type is the Profile type +// or extends from the Profile type. +func IsOrExtendsProfile(other vocab.Type) bool { + if other.GetTypeName() == "Profile" { + return true + } + return this.ProfileIsExtendedBy(other) +} + // NewActivityStreamsProfile creates a new Profile type func NewActivityStreamsProfile() *ActivityStreamsProfile { typeProp := typePropertyConstructor() @@ -381,7 +390,8 @@ func ProfileIsDisjointWith(other vocab.Type) bool { } // ProfileIsExtendedBy returns true if the other provided type extends from the -// Profile type. +// Profile type. Note that it returns false if the types are the same; see the +// "IsOrExtendsProfile" variant instead. func ProfileIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_question/gen_type_activitystreams_question.go b/streams/impl/activitystreams/type_question/gen_type_activitystreams_question.go index 9cc4a79..24bd677 100644 --- a/streams/impl/activitystreams/type_question/gen_type_activitystreams_question.go +++ b/streams/impl/activitystreams/type_question/gen_type_activitystreams_question.go @@ -421,6 +421,15 @@ func DeserializeQuestion(m map[string]interface{}, aliasMap map[string]string) ( return this, nil } +// IsOrExtendsQuestion returns true if the other provided type is the Question +// type or extends from the Question type. +func IsOrExtendsQuestion(other vocab.Type) bool { + if other.GetTypeName() == "Question" { + return true + } + return this.QuestionIsExtendedBy(other) +} + // NewActivityStreamsQuestion creates a new Question type func NewActivityStreamsQuestion() *ActivityStreamsQuestion { typeProp := typePropertyConstructor() @@ -445,7 +454,8 @@ func QuestionIsDisjointWith(other vocab.Type) bool { } // QuestionIsExtendedBy returns true if the other provided type extends from the -// Question type. +// Question type. Note that it returns false if the types are the same; see +// the "IsOrExtendsQuestion" variant instead. func QuestionIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_read/gen_type_activitystreams_read.go b/streams/impl/activitystreams/type_read/gen_type_activitystreams_read.go index a3a84b7..9a441b0 100644 --- a/streams/impl/activitystreams/type_read/gen_type_activitystreams_read.go +++ b/streams/impl/activitystreams/type_read/gen_type_activitystreams_read.go @@ -388,6 +388,15 @@ func DeserializeRead(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsRead returns true if the other provided type is the Read type or +// extends from the Read type. +func IsOrExtendsRead(other vocab.Type) bool { + if other.GetTypeName() == "Read" { + return true + } + return this.ReadIsExtendedBy(other) +} + // NewActivityStreamsRead creates a new Read type func NewActivityStreamsRead() *ActivityStreamsRead { typeProp := typePropertyConstructor() @@ -412,7 +421,8 @@ func ReadIsDisjointWith(other vocab.Type) bool { } // ReadIsExtendedBy returns true if the other provided type extends from the Read -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsRead" variant instead. func ReadIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_reject/gen_type_activitystreams_reject.go b/streams/impl/activitystreams/type_reject/gen_type_activitystreams_reject.go index 7de1817..68be598 100644 --- a/streams/impl/activitystreams/type_reject/gen_type_activitystreams_reject.go +++ b/streams/impl/activitystreams/type_reject/gen_type_activitystreams_reject.go @@ -396,6 +396,15 @@ func DeserializeReject(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsReject returns true if the other provided type is the Reject type or +// extends from the Reject type. +func IsOrExtendsReject(other vocab.Type) bool { + if other.GetTypeName() == "Reject" { + return true + } + return this.RejectIsExtendedBy(other) +} + // NewActivityStreamsReject creates a new Reject type func NewActivityStreamsReject() *ActivityStreamsReject { typeProp := typePropertyConstructor() @@ -420,7 +429,8 @@ func RejectIsDisjointWith(other vocab.Type) bool { } // RejectIsExtendedBy returns true if the other provided type extends from the -// Reject type. +// Reject type. Note that it returns false if the types are the same; see the +// "IsOrExtendsReject" variant instead. func RejectIsExtendedBy(other vocab.Type) bool { extensions := []string{"TentativeReject"} for _, ext := range extensions { diff --git a/streams/impl/activitystreams/type_relationship/gen_type_activitystreams_relationship.go b/streams/impl/activitystreams/type_relationship/gen_type_activitystreams_relationship.go index 3ff81bc..a3700e9 100644 --- a/streams/impl/activitystreams/type_relationship/gen_type_activitystreams_relationship.go +++ b/streams/impl/activitystreams/type_relationship/gen_type_activitystreams_relationship.go @@ -370,6 +370,15 @@ func DeserializeRelationship(m map[string]interface{}, aliasMap map[string]strin return this, nil } +// IsOrExtendsRelationship returns true if the other provided type is the +// Relationship type or extends from the Relationship type. +func IsOrExtendsRelationship(other vocab.Type) bool { + if other.GetTypeName() == "Relationship" { + return true + } + return this.RelationshipIsExtendedBy(other) +} + // NewActivityStreamsRelationship creates a new Relationship type func NewActivityStreamsRelationship() *ActivityStreamsRelationship { typeProp := typePropertyConstructor() @@ -394,7 +403,8 @@ func RelationshipIsDisjointWith(other vocab.Type) bool { } // RelationshipIsExtendedBy returns true if the other provided type extends from -// the Relationship type. +// the Relationship type. Note that it returns false if the types are the +// same; see the "IsOrExtendsRelationship" variant instead. func RelationshipIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_remove/gen_type_activitystreams_remove.go b/streams/impl/activitystreams/type_remove/gen_type_activitystreams_remove.go index bddeb29..0ad7862 100644 --- a/streams/impl/activitystreams/type_remove/gen_type_activitystreams_remove.go +++ b/streams/impl/activitystreams/type_remove/gen_type_activitystreams_remove.go @@ -411,6 +411,15 @@ func DeserializeRemove(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsRemove returns true if the other provided type is the Remove type or +// extends from the Remove type. +func IsOrExtendsRemove(other vocab.Type) bool { + if other.GetTypeName() == "Remove" { + return true + } + return this.RemoveIsExtendedBy(other) +} + // NewActivityStreamsRemove creates a new Remove type func NewActivityStreamsRemove() *ActivityStreamsRemove { typeProp := typePropertyConstructor() @@ -435,7 +444,8 @@ func RemoveIsDisjointWith(other vocab.Type) bool { } // RemoveIsExtendedBy returns true if the other provided type extends from the -// Remove type. +// Remove type. Note that it returns false if the types are the same; see the +// "IsOrExtendsRemove" variant instead. func RemoveIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_service/gen_type_activitystreams_service.go b/streams/impl/activitystreams/type_service/gen_type_activitystreams_service.go index 69a3282..b511c6c 100644 --- a/streams/impl/activitystreams/type_service/gen_type_activitystreams_service.go +++ b/streams/impl/activitystreams/type_service/gen_type_activitystreams_service.go @@ -401,6 +401,15 @@ func DeserializeService(m map[string]interface{}, aliasMap map[string]string) (* return this, nil } +// IsOrExtendsService returns true if the other provided type is the Service type +// or extends from the Service type. +func IsOrExtendsService(other vocab.Type) bool { + if other.GetTypeName() == "Service" { + return true + } + return this.ServiceIsExtendedBy(other) +} + // NewActivityStreamsService creates a new Service type func NewActivityStreamsService() *ActivityStreamsService { typeProp := typePropertyConstructor() @@ -425,7 +434,8 @@ func ServiceIsDisjointWith(other vocab.Type) bool { } // ServiceIsExtendedBy returns true if the other provided type extends from the -// Service type. +// Service type. Note that it returns false if the types are the same; see the +// "IsOrExtendsService" variant instead. func ServiceIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_tentativeaccept/gen_type_activitystreams_tentativeaccept.go b/streams/impl/activitystreams/type_tentativeaccept/gen_type_activitystreams_tentativeaccept.go index e99f7ce..994ba9b 100644 --- a/streams/impl/activitystreams/type_tentativeaccept/gen_type_activitystreams_tentativeaccept.go +++ b/streams/impl/activitystreams/type_tentativeaccept/gen_type_activitystreams_tentativeaccept.go @@ -395,6 +395,15 @@ func DeserializeTentativeAccept(m map[string]interface{}, aliasMap map[string]st return this, nil } +// IsOrExtendsTentativeAccept returns true if the other provided type is the +// TentativeAccept type or extends from the TentativeAccept type. +func IsOrExtendsTentativeAccept(other vocab.Type) bool { + if other.GetTypeName() == "TentativeAccept" { + return true + } + return this.TentativeAcceptIsExtendedBy(other) +} + // NewActivityStreamsTentativeAccept creates a new TentativeAccept type func NewActivityStreamsTentativeAccept() *ActivityStreamsTentativeAccept { typeProp := typePropertyConstructor() @@ -419,7 +428,8 @@ func TentativeAcceptIsDisjointWith(other vocab.Type) bool { } // TentativeAcceptIsExtendedBy returns true if the other provided type extends -// from the TentativeAccept type. +// from the TentativeAccept type. Note that it returns false if the types are +// the same; see the "IsOrExtendsTentativeAccept" variant instead. func TentativeAcceptIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_tentativereject/gen_type_activitystreams_tentativereject.go b/streams/impl/activitystreams/type_tentativereject/gen_type_activitystreams_tentativereject.go index 59bcfe9..2ce7eda 100644 --- a/streams/impl/activitystreams/type_tentativereject/gen_type_activitystreams_tentativereject.go +++ b/streams/impl/activitystreams/type_tentativereject/gen_type_activitystreams_tentativereject.go @@ -395,6 +395,15 @@ func DeserializeTentativeReject(m map[string]interface{}, aliasMap map[string]st return this, nil } +// IsOrExtendsTentativeReject returns true if the other provided type is the +// TentativeReject type or extends from the TentativeReject type. +func IsOrExtendsTentativeReject(other vocab.Type) bool { + if other.GetTypeName() == "TentativeReject" { + return true + } + return this.TentativeRejectIsExtendedBy(other) +} + // NewActivityStreamsTentativeReject creates a new TentativeReject type func NewActivityStreamsTentativeReject() *ActivityStreamsTentativeReject { typeProp := typePropertyConstructor() @@ -419,7 +428,8 @@ func TentativeRejectIsDisjointWith(other vocab.Type) bool { } // TentativeRejectIsExtendedBy returns true if the other provided type extends -// from the TentativeReject type. +// from the TentativeReject type. Note that it returns false if the types are +// the same; see the "IsOrExtendsTentativeReject" variant instead. func TentativeRejectIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_tombstone/gen_type_activitystreams_tombstone.go b/streams/impl/activitystreams/type_tombstone/gen_type_activitystreams_tombstone.go index c6a367f..33541be 100644 --- a/streams/impl/activitystreams/type_tombstone/gen_type_activitystreams_tombstone.go +++ b/streams/impl/activitystreams/type_tombstone/gen_type_activitystreams_tombstone.go @@ -378,6 +378,15 @@ func DeserializeTombstone(m map[string]interface{}, aliasMap map[string]string) return this, nil } +// IsOrExtendsTombstone returns true if the other provided type is the Tombstone +// type or extends from the Tombstone type. +func IsOrExtendsTombstone(other vocab.Type) bool { + if other.GetTypeName() == "Tombstone" { + return true + } + return this.TombstoneIsExtendedBy(other) +} + // NewActivityStreamsTombstone creates a new Tombstone type func NewActivityStreamsTombstone() *ActivityStreamsTombstone { typeProp := typePropertyConstructor() @@ -402,7 +411,8 @@ func TombstoneIsDisjointWith(other vocab.Type) bool { } // TombstoneIsExtendedBy returns true if the other provided type extends from the -// Tombstone type. +// Tombstone type. Note that it returns false if the types are the same; see +// the "IsOrExtendsTombstone" variant instead. func TombstoneIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_travel/gen_type_activitystreams_travel.go b/streams/impl/activitystreams/type_travel/gen_type_activitystreams_travel.go index a81c1a4..368c8b2 100644 --- a/streams/impl/activitystreams/type_travel/gen_type_activitystreams_travel.go +++ b/streams/impl/activitystreams/type_travel/gen_type_activitystreams_travel.go @@ -389,6 +389,15 @@ func DeserializeTravel(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsTravel returns true if the other provided type is the Travel type or +// extends from the Travel type. +func IsOrExtendsTravel(other vocab.Type) bool { + if other.GetTypeName() == "Travel" { + return true + } + return this.TravelIsExtendedBy(other) +} + // NewActivityStreamsTravel creates a new Travel type func NewActivityStreamsTravel() *ActivityStreamsTravel { typeProp := typePropertyConstructor() @@ -413,7 +422,8 @@ func TravelIsDisjointWith(other vocab.Type) bool { } // TravelIsExtendedBy returns true if the other provided type extends from the -// Travel type. +// Travel type. Note that it returns false if the types are the same; see the +// "IsOrExtendsTravel" variant instead. func TravelIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_undo/gen_type_activitystreams_undo.go b/streams/impl/activitystreams/type_undo/gen_type_activitystreams_undo.go index a8a839d..53bd025 100644 --- a/streams/impl/activitystreams/type_undo/gen_type_activitystreams_undo.go +++ b/streams/impl/activitystreams/type_undo/gen_type_activitystreams_undo.go @@ -394,6 +394,15 @@ func DeserializeUndo(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsUndo returns true if the other provided type is the Undo type or +// extends from the Undo type. +func IsOrExtendsUndo(other vocab.Type) bool { + if other.GetTypeName() == "Undo" { + return true + } + return this.UndoIsExtendedBy(other) +} + // NewActivityStreamsUndo creates a new Undo type func NewActivityStreamsUndo() *ActivityStreamsUndo { typeProp := typePropertyConstructor() @@ -418,7 +427,8 @@ func UndoIsDisjointWith(other vocab.Type) bool { } // UndoIsExtendedBy returns true if the other provided type extends from the Undo -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsUndo" variant instead. func UndoIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_update/gen_type_activitystreams_update.go b/streams/impl/activitystreams/type_update/gen_type_activitystreams_update.go index 8bb89a0..61361d8 100644 --- a/streams/impl/activitystreams/type_update/gen_type_activitystreams_update.go +++ b/streams/impl/activitystreams/type_update/gen_type_activitystreams_update.go @@ -391,6 +391,15 @@ func DeserializeUpdate(m map[string]interface{}, aliasMap map[string]string) (*A return this, nil } +// IsOrExtendsUpdate returns true if the other provided type is the Update type or +// extends from the Update type. +func IsOrExtendsUpdate(other vocab.Type) bool { + if other.GetTypeName() == "Update" { + return true + } + return this.UpdateIsExtendedBy(other) +} + // NewActivityStreamsUpdate creates a new Update type func NewActivityStreamsUpdate() *ActivityStreamsUpdate { typeProp := typePropertyConstructor() @@ -415,7 +424,8 @@ func UpdateIsDisjointWith(other vocab.Type) bool { } // UpdateIsExtendedBy returns true if the other provided type extends from the -// Update type. +// Update type. Note that it returns false if the types are the same; see the +// "IsOrExtendsUpdate" variant instead. func UpdateIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_video/gen_type_activitystreams_video.go b/streams/impl/activitystreams/type_video/gen_type_activitystreams_video.go index cb47b82..8f4b2cb 100644 --- a/streams/impl/activitystreams/type_video/gen_type_activitystreams_video.go +++ b/streams/impl/activitystreams/type_video/gen_type_activitystreams_video.go @@ -345,6 +345,15 @@ func DeserializeVideo(m map[string]interface{}, aliasMap map[string]string) (*Ac return this, nil } +// IsOrExtendsVideo returns true if the other provided type is the Video type or +// extends from the Video type. +func IsOrExtendsVideo(other vocab.Type) bool { + if other.GetTypeName() == "Video" { + return true + } + return this.VideoIsExtendedBy(other) +} + // NewActivityStreamsVideo creates a new Video type func NewActivityStreamsVideo() *ActivityStreamsVideo { typeProp := typePropertyConstructor() @@ -369,7 +378,8 @@ func VideoIsDisjointWith(other vocab.Type) bool { } // VideoIsExtendedBy returns true if the other provided type extends from the -// Video type. +// Video type. Note that it returns false if the types are the same; see the +// "IsOrExtendsVideo" variant instead. func VideoIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false diff --git a/streams/impl/activitystreams/type_view/gen_type_activitystreams_view.go b/streams/impl/activitystreams/type_view/gen_type_activitystreams_view.go index c3f03f6..511bf01 100644 --- a/streams/impl/activitystreams/type_view/gen_type_activitystreams_view.go +++ b/streams/impl/activitystreams/type_view/gen_type_activitystreams_view.go @@ -391,6 +391,15 @@ func DeserializeView(m map[string]interface{}, aliasMap map[string]string) (*Act return this, nil } +// IsOrExtendsView returns true if the other provided type is the View type or +// extends from the View type. +func IsOrExtendsView(other vocab.Type) bool { + if other.GetTypeName() == "View" { + return true + } + return this.ViewIsExtendedBy(other) +} + // NewActivityStreamsView creates a new View type func NewActivityStreamsView() *ActivityStreamsView { typeProp := typePropertyConstructor() @@ -415,7 +424,8 @@ func ViewIsDisjointWith(other vocab.Type) bool { } // ViewIsExtendedBy returns true if the other provided type extends from the View -// type. +// type. Note that it returns false if the types are the same; see the +// "IsOrExtendsView" variant instead. func ViewIsExtendedBy(other vocab.Type) bool { // Shortcut implementation: is not extended by anything. return false