com.azure.resourcemanager.servicefabricmanagedclusters.models.UniformInt64RangePartitionScheme Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.servicefabricmanagedclusters.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Describes a partitioning scheme where an integer range is allocated evenly across a number of partitions.
*/
@Fluent
public final class UniformInt64RangePartitionScheme extends Partition {
/*
* Specifies how the service is partitioned.
*/
private PartitionScheme partitionScheme = PartitionScheme.UNIFORM_INT64RANGE;
/*
* The number of partitions.
*/
private int count;
/*
* The lower bound of the partition key range that
* should be split between the partition ‘Count’
*/
private long lowKey;
/*
* The upper bound of the partition key range that
* should be split between the partition ‘Count’
*/
private long highKey;
/**
* Creates an instance of UniformInt64RangePartitionScheme class.
*/
public UniformInt64RangePartitionScheme() {
}
/**
* Get the partitionScheme property: Specifies how the service is partitioned.
*
* @return the partitionScheme value.
*/
@Override
public PartitionScheme partitionScheme() {
return this.partitionScheme;
}
/**
* Get the count property: The number of partitions.
*
* @return the count value.
*/
public int count() {
return this.count;
}
/**
* Set the count property: The number of partitions.
*
* @param count the count value to set.
* @return the UniformInt64RangePartitionScheme object itself.
*/
public UniformInt64RangePartitionScheme withCount(int count) {
this.count = count;
return this;
}
/**
* Get the lowKey property: The lower bound of the partition key range that
* should be split between the partition ‘Count’.
*
* @return the lowKey value.
*/
public long lowKey() {
return this.lowKey;
}
/**
* Set the lowKey property: The lower bound of the partition key range that
* should be split between the partition ‘Count’.
*
* @param lowKey the lowKey value to set.
* @return the UniformInt64RangePartitionScheme object itself.
*/
public UniformInt64RangePartitionScheme withLowKey(long lowKey) {
this.lowKey = lowKey;
return this;
}
/**
* Get the highKey property: The upper bound of the partition key range that
* should be split between the partition ‘Count’.
*
* @return the highKey value.
*/
public long highKey() {
return this.highKey;
}
/**
* Set the highKey property: The upper bound of the partition key range that
* should be split between the partition ‘Count’.
*
* @param highKey the highKey value to set.
* @return the UniformInt64RangePartitionScheme object itself.
*/
public UniformInt64RangePartitionScheme withHighKey(long highKey) {
this.highKey = highKey;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
super.validate();
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeIntField("count", this.count);
jsonWriter.writeLongField("lowKey", this.lowKey);
jsonWriter.writeLongField("highKey", this.highKey);
jsonWriter.writeStringField("partitionScheme",
this.partitionScheme == null ? null : this.partitionScheme.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of UniformInt64RangePartitionScheme from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of UniformInt64RangePartitionScheme if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the UniformInt64RangePartitionScheme.
*/
public static UniformInt64RangePartitionScheme fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
UniformInt64RangePartitionScheme deserializedUniformInt64RangePartitionScheme
= new UniformInt64RangePartitionScheme();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("count".equals(fieldName)) {
deserializedUniformInt64RangePartitionScheme.count = reader.getInt();
} else if ("lowKey".equals(fieldName)) {
deserializedUniformInt64RangePartitionScheme.lowKey = reader.getLong();
} else if ("highKey".equals(fieldName)) {
deserializedUniformInt64RangePartitionScheme.highKey = reader.getLong();
} else if ("partitionScheme".equals(fieldName)) {
deserializedUniformInt64RangePartitionScheme.partitionScheme
= PartitionScheme.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedUniformInt64RangePartitionScheme;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy