
com.marklogic.client.query.CountedDistinctValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marklogic-client-api Show documentation
Show all versions of marklogic-client-api Show documentation
The official MarkLogic Java client API.
The newest version!
/*
* Copyright © 2024 MarkLogic Corporation. All Rights Reserved.
*/
package com.marklogic.client.query;
import com.marklogic.client.impl.ValueConverter;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlValue;
/**
* A CountedDistinctValue is a value that includes a frequency.
*/
public class CountedDistinctValue {
@XmlAttribute(name = "frequency")
long frequency;
@XmlValue
String value;
/**
* Returns the frequency associated with this value.
* @return The frequency.
*/
public long getCount() {
return frequency;
}
/**
* Returns the value cast to the specified type.
*
* This method converts the value according to the supplied type and then casts it
* to the specified class.
*
* The following types are supported:
* xs:anySimpleType
,
* xs:base64Binary
, xs:boolean
,
* xs:byte
, xs:date
,
* xs:dateTime
, xs:dayTimeDuration
,
* xs:decimal
, xs:double
,
* xs:duration
, xs:float
,
* xs:int
, xs:integer
,
* xs:long
, xs:short
,
* xs:string
, xs:time
,
* xs:unsignedInt
, xs:unsignedLong
,
* xs:unsignedShort
, and
* xs:yearMonthDuration
.
*
* @see ValueConverter#convertToJava(String,String) label
* @param type The name of the XSD type to use for conversion.
* @param as The class parameter
* @param The class to cast to
* @return The value, cast to the specified type or
*/
public T get(String type, Class as) {
return ValueConverter.convertToJava(type, value, as);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy