LuceneIndexProperty.java 3.62 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.google.common.base.Preconditions
 *  com.google.common.base.Strings
 *  javax.annotation.Nonnull
 *  javax.jcr.PropertyType
 */
package com.adobe.granite.repository.impl.lucene.util;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import javax.annotation.Nonnull;
import javax.jcr.PropertyType;

public class LuceneIndexProperty {
    public static final int TYPE_UNDEFINED = Integer.MIN_VALUE;
    private boolean propertyIndex;
    private boolean ordered;
    private boolean analyzed;
    private boolean useInSuggest;
    private String nodeName;
    private String property;
    private String type;
    private boolean useInSpellcheck;
    private boolean nullCheckEnabled;
    private boolean nodeScopeIndex;

    public LuceneIndexProperty(@Nonnull String nodeName, boolean propertyIndex, @Nonnull String property, int type) {
        this(nodeName, propertyIndex, property, type, false);
    }

    public LuceneIndexProperty(@Nonnull String nodeName, boolean propertyIndex, @Nonnull String property, int type, boolean ordered) {
        this(nodeName, propertyIndex, property, type, ordered, false);
    }

    public LuceneIndexProperty(@Nonnull String nodeName, boolean propertyIndex, @Nonnull String property, int type, boolean ordered, boolean analyzed) {
        Preconditions.checkArgument((boolean)(!Strings.isNullOrEmpty((String)nodeName)));
        Preconditions.checkArgument((boolean)(!Strings.isNullOrEmpty((String)property)));
        this.nodeName = nodeName;
        this.propertyIndex = propertyIndex;
        this.property = property;
        this.type = type == Integer.MIN_VALUE ? null : PropertyType.nameFromValue((int)type);
        this.ordered = ordered;
        this.analyzed = analyzed;
    }

    public LuceneIndexProperty(@Nonnull String nodeName, boolean propertyIndex, @Nonnull String property, int type, boolean ordered, boolean analyzed, boolean useInSuggest) {
        this(nodeName, propertyIndex, property, type, ordered, analyzed);
        this.useInSuggest = useInSuggest;
    }

    public LuceneIndexProperty(@Nonnull String nodeName, boolean propertyIndex, @Nonnull String property, int type, boolean ordered, boolean analyzed, boolean useInSuggest, boolean useInSpellcheck) {
        this(nodeName, propertyIndex, property, type, ordered, analyzed, useInSuggest);
        this.useInSpellcheck = useInSpellcheck;
    }

    public boolean isPropertyIndex() {
        return this.propertyIndex;
    }

    public String getProperty() {
        return this.property;
    }

    public String getType() {
        return this.type;
    }

    public String getNodeName() {
        return this.nodeName;
    }

    public boolean isOrdered() {
        return this.ordered;
    }

    public boolean isAnalyzed() {
        return this.analyzed;
    }

    public boolean isUseInSuggest() {
        return this.useInSuggest;
    }

    public LuceneIndexProperty withUseInSuggest(boolean useInSuggest) {
        this.useInSuggest = useInSuggest;
        return this;
    }

    public boolean isUseInSpellcheck() {
        return this.useInSpellcheck;
    }

    public boolean isNullCheckEnabled() {
        return this.nullCheckEnabled;
    }

    public LuceneIndexProperty withNullCheckEnabled(boolean nullCheckEnabled) {
        this.nullCheckEnabled = nullCheckEnabled;
        return this;
    }

    public boolean isNodeScopeIndex() {
        return this.nodeScopeIndex;
    }

    public LuceneIndexProperty withNodeScopeIndex(boolean nodeScopeIndex) {
        this.nodeScopeIndex = nodeScopeIndex;
        return this;
    }
}