[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [cti-users] Java STIX 2.x Libary
Hey Everyone just little update for the java lib. I have started cleanup refactor now that all of the angles were generally covered. All of the objects have been implemented as Immutable and you get a nice builder interface for everything: when: There are lots of helper methods that come with the builders as well, allowing you to transfer from one Immutable to another. All objects support two modes of Hydration: dehydrated: Type+ID or Hydrated: normal attribute requirements. With dehydrated this is a object that only contains a type and a Id (such as when deserializing a object with a relationship). A interesting factor here is the easy ability extend this to any fields and add additional layers, as its all enforced with validation groups: @NotBlank(groups = {Default.class, ValidateIdOnly.class}, message = "Type is required") vs another attribute such as: @NotNull The example above allows anyone to easily extend or configure hydration or dehydrated attribute requirements with a singleÂgroups = {Default.class, ValidateIdOnly.class} Âwhich says âenforce this validation for the Default group and the ValidateIdOnlyGroup. When no group is provided the default group enforcement is used. You also get Annotation validators, allowing really easy extension: So consider where Malware SDO reuses the Labels but enforces (or with a âSHOULDâ) of a specific vocabulary: you get to use Annotations! @Override @Vocab can be used on Strings and on Sets of Strings. Allowing default and custom vocab usage. There is also Â@RelationshipTypeLimit @RelationshipTypeLimit(source = MalwareSdo.class, relationshipTypes = {"targets", "uses", "variant-of"}) and then there is @RelationshipLimit: @RelationshipLimit(source = MalwareSdo.class, relationshipType = "targets", target = {IdentitySdo.class, VulnerabilitySdo.class}) or: @RelationshipLimit(source = DomainObject.class, relationshipType = "derived-from", target = {DomainObject.class}, classEquality = true) This allows you to defined Target-ref restrictions for relationship Types and Source SDOs. Enjoy! From:ÂStephen Russett <stephen@digitalstate.ca> Reply:ÂStephen Russett <stephen@digitalstate.ca> Date:ÂNovember 29, 2018 at 8:48:11 PM To:Âcti-users@lists.oasis-open.org <cti-users@lists.oasis-open.org> Subject: Re: [cti-users] Java STIX 2.x Libary
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]