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

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

/*
 * Copyright 2012-2016 MarkLogic Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.marklogic.client.query;

import com.marklogic.client.impl.ValueConverter;

import javax.xml.bind.annotation.XmlAttribute;
import javax.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 - 2024 Weber Informatics LLC | Privacy Policy