All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.marklogic.client.query.AggregateResult Maven / Gradle / Ivy

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 AggregateResult {
  @XmlAttribute(name = "name")
  String name;

  @XmlValue
  String value;

  /**
   * Returns the name of this aggregate.
   * @return The name.
   */
  public String getName() {
    return name;
  }

  /**
   * Returns the value of this aggregate as a string.
   *
   * 

Use get() to convert the string value into a typed value.

* * @return The aggrevate value. */ public String getValue() { return value; } /** * 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 com.marklogic.client.impl.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