Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file 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.amazonaws.services.cloudsearch.model;
 

Defines a field in the index, including its name, type, and the source of its data. The IndexFieldType indicates which of the options will be present. It is invalid to specify options for a type other than the IndexFieldType .

 
 public class IndexField implements Serializable {

    
The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.

Constraints:
Length: 1 - 64
Pattern: [a-z][a-z0-9_]*

 
     private String indexFieldName;

    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Constraints:
Allowed Values: uint, literal, text

 
     private String indexFieldType;

    
Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.
 
     private UIntOptions uIntOptions;

    
Options for literal field. Present if IndexFieldType specifies the field is of type literal.
 
     private LiteralOptions literalOptions;

    
Options for text field. Present if IndexFieldType specifies the field is of type text.
 
     private TextOptions textOptions;

    
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.
 
The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.

Constraints:
Length: 1 - 64
Pattern: [a-z][a-z0-9_]*

Returns:
The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.
 
     public String getIndexFieldName() {
         return ;
    }
    
    
The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.

Constraints:
Length: 1 - 64
Pattern: [a-z][a-z0-9_]*

Parameters:
indexFieldName The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.
    public void setIndexFieldName(String indexFieldName) {
        this. = indexFieldName;
    }
    
    
The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 64
Pattern: [a-z][a-z0-9_]*

Parameters:
indexFieldName The name of a field in the search index. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withIndexFieldName(String indexFieldName) {
        this. = indexFieldName;
        return this;
    }

    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Constraints:
Allowed Values: uint, literal, text

Returns:
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.
See also:
IndexFieldType
    public String getIndexFieldType() {
        return ;
    }
    
    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Constraints:
Allowed Values: uint, literal, text

Parameters:
indexFieldType The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.
See also:
IndexFieldType
    public void setIndexFieldType(String indexFieldType) {
        this. = indexFieldType;
    }
    
    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: uint, literal, text

Parameters:
indexFieldType The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
IndexFieldType
    public IndexField withIndexFieldType(String indexFieldType) {
        this. = indexFieldType;
        return this;
    }

    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Constraints:
Allowed Values: uint, literal, text

Parameters:
indexFieldType The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.
See also:
IndexFieldType
    public void setIndexFieldType(IndexFieldType indexFieldType) {
        this. = indexFieldType.toString();
    }
    
    
The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: uint, literal, text

Parameters:
indexFieldType The type of field. Based on this type, exactly one of the UIntOptions, LiteralOptions or TextOptions must be present.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
IndexFieldType
    public IndexField withIndexFieldType(IndexFieldType indexFieldType) {
        this. = indexFieldType.toString();
        return this;
    }

    
Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.

Returns:
Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.
    public UIntOptions getUIntOptions() {
        return ;
    }
    
    
Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.

Parameters:
uIntOptions Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.
    public void setUIntOptions(UIntOptions uIntOptions) {
        this. = uIntOptions;
    }
    
    
Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.

Returns a reference to this object so that method calls can be chained together.

Parameters:
uIntOptions Options for an unsigned integer field. Present if IndexFieldType specifies the field is of type unsigned integer.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withUIntOptions(UIntOptions uIntOptions) {
        this. = uIntOptions;
        return this;
    }

    
Options for literal field. Present if IndexFieldType specifies the field is of type literal.

Returns:
Options for literal field. Present if IndexFieldType specifies the field is of type literal.
    public LiteralOptions getLiteralOptions() {
        return ;
    }
    
    
Options for literal field. Present if IndexFieldType specifies the field is of type literal.

Parameters:
literalOptions Options for literal field. Present if IndexFieldType specifies the field is of type literal.
    public void setLiteralOptions(LiteralOptions literalOptions) {
        this. = literalOptions;
    }
    
    
Options for literal field. Present if IndexFieldType specifies the field is of type literal.

Returns a reference to this object so that method calls can be chained together.

Parameters:
literalOptions Options for literal field. Present if IndexFieldType specifies the field is of type literal.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withLiteralOptions(LiteralOptions literalOptions) {
        this. = literalOptions;
        return this;
    }

    
Options for text field. Present if IndexFieldType specifies the field is of type text.

Returns:
Options for text field. Present if IndexFieldType specifies the field is of type text.
    public TextOptions getTextOptions() {
        return ;
    }
    
    
Options for text field. Present if IndexFieldType specifies the field is of type text.

Parameters:
textOptions Options for text field. Present if IndexFieldType specifies the field is of type text.
    public void setTextOptions(TextOptions textOptions) {
        this. = textOptions;
    }
    
    
Options for text field. Present if IndexFieldType specifies the field is of type text.

Returns a reference to this object so that method calls can be chained together.

Parameters:
textOptions Options for text field. Present if IndexFieldType specifies the field is of type text.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withTextOptions(TextOptions textOptions) {
        this. = textOptions;
        return this;
    }

    
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.

Returns:
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.

Parameters:
sourceAttributes An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.
    public void setSourceAttributes(java.util.Collection<SourceAttributesourceAttributes) {
        if (sourceAttributes == null) {
            this. = null;
            return;
        }
        sourceAttributesCopy.addAll(sourceAttributes);
        this. = sourceAttributesCopy;
    }
    
    
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sourceAttributes An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withSourceAttributes(SourceAttribute... sourceAttributes) {
        if (getSourceAttributes() == nullsetSourceAttributes(new java.util.ArrayList<SourceAttribute>(sourceAttributes.length));
        for (SourceAttribute value : sourceAttributes) {
            getSourceAttributes().add(value);
        }
        return this;
    }
    
    
An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sourceAttributes An optional list of source attributes that provide data for this index field. If not specified, the data is pulled from a source attribute with the same name as this IndexField. When one or more source attributes are specified, an optional data transformation can be applied to the source data when populating the index field. You can configure a maximum of 20 sources for an IndexField.
Returns:
A reference to this updated object so that method calls can be chained together.
    public IndexField withSourceAttributes(java.util.Collection<SourceAttributesourceAttributes) {
        if (sourceAttributes == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<SourceAttributesourceAttributesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<SourceAttribute>(sourceAttributes.size());
            sourceAttributesCopy.addAll(sourceAttributes);
            this. = sourceAttributesCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getIndexFieldName() != nullsb.append("IndexFieldName: " + getIndexFieldName() + ",");
        if (getIndexFieldType() != nullsb.append("IndexFieldType: " + getIndexFieldType() + ",");
        if (getUIntOptions() != nullsb.append("UIntOptions: " + getUIntOptions() + ",");
        if (getLiteralOptions() != nullsb.append("LiteralOptions: " + getLiteralOptions() + ",");
        if (getTextOptions() != nullsb.append("TextOptions: " + getTextOptions() + ",");
        if (getSourceAttributes() != nullsb.append("SourceAttributes: " + getSourceAttributes() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getIndexFieldName() == null) ? 0 : getIndexFieldName().hashCode()); 
        hashCode = prime * hashCode + ((getIndexFieldType() == null) ? 0 : getIndexFieldType().hashCode()); 
        hashCode = prime * hashCode + ((getUIntOptions() == null) ? 0 : getUIntOptions().hashCode()); 
        hashCode = prime * hashCode + ((getLiteralOptions() == null) ? 0 : getLiteralOptions().hashCode()); 
        hashCode = prime * hashCode + ((getTextOptions() == null) ? 0 : getTextOptions().hashCode()); 
        hashCode = prime * hashCode + ((getSourceAttributes() == null) ? 0 : getSourceAttributes().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof IndexField == falsereturn false;
        IndexField other = (IndexField)obj;
        
        if (other.getIndexFieldName() == null ^ this.getIndexFieldName() == nullreturn false;
        if (other.getIndexFieldName() != null && other.getIndexFieldName().equals(this.getIndexFieldName()) == falsereturn false
        if (other.getIndexFieldType() == null ^ this.getIndexFieldType() == nullreturn false;
        if (other.getIndexFieldType() != null && other.getIndexFieldType().equals(this.getIndexFieldType()) == falsereturn false
        if (other.getUIntOptions() == null ^ this.getUIntOptions() == nullreturn false;
        if (other.getUIntOptions() != null && other.getUIntOptions().equals(this.getUIntOptions()) == falsereturn false
        if (other.getLiteralOptions() == null ^ this.getLiteralOptions() == nullreturn false;
        if (other.getLiteralOptions() != null && other.getLiteralOptions().equals(this.getLiteralOptions()) == falsereturn false
        if (other.getTextOptions() == null ^ this.getTextOptions() == nullreturn false;
        if (other.getTextOptions() != null && other.getTextOptions().equals(this.getTextOptions()) == falsereturn false
        if (other.getSourceAttributes() == null ^ this.getSourceAttributes() == nullreturn false;
        if (other.getSourceAttributes() != null && other.getSourceAttributes().equals(this.getSourceAttributes()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X