class ImmutableThing implements Thing {

    @Override
    public Thing setDefinition(@Nullable final CharSequence definitionIdentifier) {
        if (null != definitionIdentifier) {
            return new ImmutableThing(thingId, acl, policyId,
                    ImmutableThingDefinition.ofParsed(definitionIdentifier),
                    attributes,
                    features,
                    lifecycle,
                    revision,
                    modified,
                    created,
                    metadata);
        } else {
            return new ImmutableThing(thingId, acl, policyId,
                    NullThingDefinition.getInstance(),
                    attributes,
                    features,
                    lifecycle,
                    revision,
                    modified,
                    created,
                    metadata);
        }
    }

    private  ImmutableThing(@Nullable final ThingId thingId,
            @Nullable final AccessControlList acl,
            @Nullable final PolicyId policyId,
            @Nullable final ThingDefinition definition,
            @Nullable final Attributes attributes,
            @Nullable final Features features,
            @Nullable final ThingLifecycle lifecycle,
            @Nullable final ThingRevision revision,
            @Nullable final Instant modified,
            @Nullable final Instant created,
            @Nullable final Metadata metadata);

}