Coverage Report - org.apache.shindig.social.opensocial.model.ListField
 
Classes in this File Line Coverage Branch Coverage Complexity
ListField
N/A
N/A
0
ListField$Field
100%
8/8
N/A
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements. See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership. The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License. You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied. See the License for the
 16  
  * specific language governing permissions and limitations under the License.
 17  
  */
 18  
 package org.apache.shindig.social.opensocial.model;
 19  
 
 20  
 import org.apache.shindig.social.core.model.ListFieldImpl;
 21  
 
 22  
 import com.google.inject.ImplementedBy;
 23  
 
 24  
 
 25  
 /**
 26  
  * <p>
 27  
  * A Interface to represent list fields where there is potential for one of the items to have a
 28  
  * primary or preferred status. Used where the List is a list of string values.
 29  
  * </p>
 30  
  * <p>
 31  
  * Introduced in v0.8.1
 32  
  * </p>
 33  
  */
 34  
 @ImplementedBy(ListFieldImpl.class)
 35  
 @Exportablebean
 36  
 public interface ListField {
 37  
 
 38  
   /**
 39  
    * The fields that represent the ListField object in serialized form.
 40  
    */
 41  1
   public static enum Field {
 42  
     /** the field name for value. */
 43  1
     VALUE("value"),
 44  
     /** the field name for type. */
 45  1
     TYPE("type"),
 46  
     /** the field name for primary. */
 47  1
     PRIMARY("primary");
 48  
 
 49  
     /**
 50  
      * The field name that the instance represents.
 51  
      */
 52  
     private final String jsonString;
 53  
 
 54  
     /**
 55  
      * create a field baseD on the name of an element.
 56  
      *
 57  
      * @param jsonString the name of the element
 58  
      */
 59  3
     private Field(String jsonString) {
 60  3
       this.jsonString = jsonString;
 61  3
     }
 62  
 
 63  
     /**
 64  
      * @return the string representation of the enum.
 65  
      */
 66  
     @Override
 67  
     public String toString() {
 68  12
       return this.jsonString;
 69  
     }
 70  
   }
 71  
 
 72  
   /**
 73  
    * The type of field for this instance, usually used to label the preferred function of the given
 74  
    * contact information. Unless otherwise specified, this string value specifies Canonical Values
 75  
    * of <em>work</em>, <em>home</em>, and <em>other</em>.
 76  
    *
 77  
    * @return the type of the field
 78  
    */
 79  
   String getType();
 80  
 
 81  
   /**
 82  
    * Set the type of the field.
 83  
    * @param type the type of the field
 84  
    */
 85  
   void setType(String type);
 86  
 
 87  
   /**
 88  
    * Get the primary value of this field, e.g. the actual e-mail address, phone number, or URL. When
 89  
    * specifying a sortBy field in the Query Parameters for a Plural Field, the default meaning is to
 90  
    * sort based on this value sub-field. Each non-empty Plural Field value MUST contain at least the
 91  
    * value sub-field, but all other sub-fields are optional.
 92  
    *
 93  
    * @return the value of the field
 94  
    */
 95  
   String getValue();
 96  
 
 97  
   /**
 98  
    * @see ListField.getValue()
 99  
    * @param value the value of the field
 100  
    */
 101  
   void setValue(String value);
 102  
 
 103  
   /**
 104  
    * Get Boolean value indicating whether this instance of the Plural Field is the primary or
 105  
    * preferred value of for this field, e.g. the preferred mailing address or primary e-mail
 106  
    * address. Service Providers MUST NOT mark more than one instance of the same Plural Field as
 107  
    * primary="true", and MAY choose not to mark any fields as primary, if this information is not
 108  
    * available. For efficiency, Service Providers SHOULD NOT mark all non-primary fields with
 109  
    * primary="false", but should instead omit this sub-field for all non-primary instances.
 110  
    *
 111  
    * @return true if this is a primary or preferred value
 112  
    */
 113  
   Boolean getPrimary();
 114  
 
 115  
   /**
 116  
    * @see ListField.getPrimary()
 117  
    * @param primary set to true if a primary or preferred value
 118  
    */
 119  
   void setPrimary(Boolean primary);
 120  
 }