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

org.apache.jackrabbit.spi.QValue Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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 org.apache.jackrabbit.spi;

import java.io.InputStream;
import java.util.Calendar;
import java.math.BigDecimal;
import java.net.URI;

import javax.jcr.Property;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Binary;

/**
 * QValue is the SPI representation of a
 * {@link javax.jcr.Value jcr value}. It therefore refers to Names
 * and Paths only and is thus isolated from session-specific
 * namespace mappings.
 */
public interface QValue {

    public static final QValue[] EMPTY_ARRAY = new QValue[0];

    /**
     * Returns the PropertyType of this QValue object.
     * It may be either of the value property types defined by the JSR 283:
     * 
    *
  • {@link PropertyType#STRING}
  • *
  • {@link PropertyType#BINARY}
  • *
  • {@link PropertyType#BOOLEAN}
  • *
  • {@link PropertyType#DATE}
  • *
  • {@link PropertyType#DECIMAL}
  • *
  • {@link PropertyType#DOUBLE}
  • *
  • {@link PropertyType#LONG}
  • *
  • {@link PropertyType#NAME}
  • *
  • {@link PropertyType#PATH}
  • *
  • {@link PropertyType#REFERENCE}
  • *
  • {@link PropertyType#URI}
  • *
  • {@link PropertyType#WEAKREFERENCE}
  • *
* * @return the PropertyType of this QValue object. */ public int getType(); /** * Returns the length of the internal value or -1 if the implementation * cannot determine the length at this time.
* NOTE: for {@link PropertyType#NAME} and {@link PropertyType#PATH} the * length of the internal value must not be used for indicating the length * of a property such as retrieved by calling {@link Property#getLength()} * and {@link Property#getLengths()}. * * @return length of this QValue object. * @throws RepositoryException */ public long getLength() throws RepositoryException; /** * Returns a String representation of this QValue * object. * * @return A String representation of this QValue * object. * @throws RepositoryException */ public String getString() throws RepositoryException; /** * Returns an InputStream representation of this QValue * object. This method always returns a new stream. * * @return A stream representation of this value. * @throws RepositoryException */ public InputStream getStream() throws RepositoryException; /** * Returns a Binary representation of this QValue * object. * * @return A Binary representation of this value. * @throws RepositoryException */ public Binary getBinary() throws RepositoryException; /** * Returns a Calendar representation of this value. * * @return A Calendar representation of this value. * @throws RepositoryException if an error occurs. */ public Calendar getCalendar() throws RepositoryException; /** * Returns a BigDecimal representation of this value. * * @return A BigDecimal representation of this value. * @throws RepositoryException if an error occurs. */ public BigDecimal getDecimal() throws RepositoryException; /** * Returns a double representation of this value. * * @return A double representation of this value. * @throws RepositoryException if an error occurs. */ public double getDouble() throws RepositoryException; /** * Returns a long representation of this value. * * @return A long representation of this value. * @throws RepositoryException if an error occurs. */ public long getLong() throws RepositoryException; /** * Returns a boolean representation of this value. * * @return A boolean representation of this value. * @throws RepositoryException if an error occurs. */ public boolean getBoolean() throws RepositoryException; /** * Returns a Name representation of this value. * * @return A Name representation of this value. * @throws RepositoryException if an error occurs. */ public Name getName() throws RepositoryException; /** * Returns a Path representation of this value. * * @return A Path representation of this value. * @throws RepositoryException if an error occurs. */ public Path getPath() throws RepositoryException; /** * Returns an URI representation of this value. * * @return A URI representation of this value. * @throws RepositoryException if an error occurs. */ public URI getURI() throws RepositoryException; /** * Frees temporarily allocated resources such as temporary file, buffer, etc. */ public void discard(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy