com.marklogic.client.pojo.annotation.PathIndexProperty 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.pojo.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** Use this annotation to specify that a Path Index (required for range
* queries) is needed for this pojo property. A path index is
* used rather than an element range index because we can restrict matches
* to only properties that are direct children of this class type. We
* do this by including the class name in the path specification on the
* path index.
*
* This annotation can be associated with a public field:
* import com.marklogic.client.pojo.annotation.PathIndexProperty;
* public class MyClass {
* {@literal @}PathIndexProperty
* public Long myLongValue;
* }
*
* or with a public getter method:
*
* public class MyClass {
* private Long myLongValue;
* {@literal @}PathIndexProperty
* public Long getMyLongValue() {
* return myLongValue;
* }
* // ... setter methods ...
* }
*
* or with a public setter method:
*
* public class MyClass {
* private Long myLongValue;
*
* // ... getter methods ...
*
* {@literal @}PathIndexProperty
* public void setMyLongValue(Long myLongValue) {
* this.myLongValue = myLongValue;
* }
* }
* Run
* {@link com.marklogic.client.pojo.util.GenerateIndexConfig} to generate
* a package that can be used by administrators to create the indexes in
* MarkLogic Server.
* @see com.marklogic.client.pojo.PojoQueryBuilder#range
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface PathIndexProperty {
ScalarType scalarType();
public enum ScalarType {
STRING ("string"),
INT ("int"),
UNSIGNED_INT ("unsignedInt"),
LONG ("long"),
UNSIGNED_LONG ("unsignedLong"),
FLOAT ("float"),
DOUBLE ("double"),
DECIMAL ("decimal"),
DATETIME ("dateTime"),
TIME ("time"),
DATE ("date"),
GYEARMONTH ("gYearMonth"),
GYEAR ("gYear"),
GMONTH ("gMonth"),
GDAY ("gDay"),
YEARMONTH_DURATION("yearMonthDuration"),
DAYTIME_DURATION ("dayTimeDuration"),
ANYURI ("anyURI");
private String string;
private ScalarType(String string) {
this.string = string;
};
public String toString() { return string; };
};
}