diff options
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java index b3dec554cdc..815e4bbf359 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java @@ -1,11 +1,29 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition; +import com.yahoo.config.application.api.FileRegistry; + import java.nio.ByteBuffer; +import java.util.Objects; public class RankExpressionBody extends DistributableResource { - public RankExpressionBody(String name, ByteBuffer body) { - super(name, body); + private final ByteBuffer blob; + + public RankExpressionBody(String name, ByteBuffer blob) { + super(name, blob); + Objects.requireNonNull(blob, "Blob cannot be null"); + this.blob = blob; + } + public ByteBuffer getBlob() { return blob; } + public void validate() { + // Remove once pathType is final + if (getPathType() != PathType.BLOB) { + throw new IllegalArgumentException("PathType must be BLOB."); + } + } + + void register(FileRegistry fileRegistry) { + register(fileRegistry, blob); } } |