Coverage Report - org.apache.shindig.social.opensocial.model.Address
 
Classes in this File Line Coverage Branch Coverage Complexity
Address
N/A
N/A
0
Address$Field
100%
15/15
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.AddressImpl;
 21  
 
 22  
 import com.google.inject.ImplementedBy;
 23  
 
 24  
 /**
 25  
  * Base interface for all address objects
 26  
  * see http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Address.Field.html.
 27  
  *
 28  
  */
 29  
 @ImplementedBy(AddressImpl.class)
 30  
 @Exportablebean
 31  
 public interface Address {
 32  
 
 33  
   /**
 34  
    * The fields that represent the address object in json form.
 35  
    */
 36  1
   public static enum Field {
 37  
     /** the field name for country. */
 38  1
     COUNTRY("country"),
 39  
     /** the field name for latitude. */
 40  1
     LATITUDE("latitude"),
 41  
     /** the field name for locality. */
 42  1
     LOCALITY("locality"),
 43  
     /** the field name for longitude. */
 44  1
     LONGITUDE("longitude"),
 45  
     /** the field name for postalCode. */
 46  1
     POSTAL_CODE("postalCode"),
 47  
     /** the field name for region. */
 48  1
     REGION("region"),
 49  
     /** the feild name for streetAddress this field may be multiple lines. */
 50  1
     STREET_ADDRESS("streetAddress"),
 51  
     /** the field name for type. */
 52  1
     TYPE("type"),
 53  
     /** the field name for formatted. */
 54  1
     FORMATTED("formatted"),
 55  
     /** the field name for primary. */
 56  1
     PRIMARY("primary");
 57  
 
 58  
     /**
 59  
      * The json field that the instance represents.
 60  
      */
 61  
     private final String jsonString;
 62  
 
 63  
     /**
 64  
      * create a field base on the a json element.
 65  
      *
 66  
      * @param jsonString the name of the element
 67  
      */
 68  10
     private Field(String jsonString) {
 69  10
       this.jsonString = jsonString;
 70  10
     }
 71  
 
 72  
     /**
 73  
      * emit the field as a json element.
 74  
      *
 75  
      * @return the field name
 76  
      */
 77  
     @Override
 78  
     public String toString() {
 79  24
       return this.jsonString;
 80  
     }
 81  
   }
 82  
 
 83  
   /**
 84  
    * Get the country.
 85  
    *
 86  
    * @return the country
 87  
    */
 88  
   String getCountry();
 89  
 
 90  
   /**
 91  
    * Set the country.
 92  
    *
 93  
    * @param country the country
 94  
    */
 95  
   void setCountry(String country);
 96  
 
 97  
   /**
 98  
    * Get the latitude.
 99  
    *
 100  
    * @return latitude
 101  
    */
 102  
   Float getLatitude();
 103  
 
 104  
   /**
 105  
    * Set the latitude.
 106  
    *
 107  
    * @param latitude latitude
 108  
    */
 109  
   void setLatitude(Float latitude);
 110  
 
 111  
   /**
 112  
    * Get the locality.
 113  
    *
 114  
    * @return the locality
 115  
    */
 116  
   String getLocality();
 117  
 
 118  
   /**
 119  
    * Set the locality.
 120  
    *
 121  
    * @param locality the locality
 122  
    */
 123  
   void setLocality(String locality);
 124  
 
 125  
   /**
 126  
    * Get the longitude of the address in degrees.
 127  
    *
 128  
    * @return the longitude of the address in degrees
 129  
    */
 130  
   Float getLongitude();
 131  
 
 132  
   /**
 133  
    * Set the longitude of the address in degrees.
 134  
    *
 135  
    * @param longitude the longitude of the address in degrees.
 136  
    */
 137  
   void setLongitude(Float longitude);
 138  
 
 139  
   /**
 140  
    * Get the Postal code for the address.
 141  
    *
 142  
    * @return the postal code for the address
 143  
    */
 144  
   String getPostalCode();
 145  
 
 146  
   /**
 147  
    * Set the postal code for the address.
 148  
    *
 149  
    * @param postalCode the postal code
 150  
    */
 151  
   void setPostalCode(String postalCode);
 152  
 
 153  
   /**
 154  
    * Get the region.
 155  
    *
 156  
    * @return the region
 157  
    */
 158  
   String getRegion();
 159  
 
 160  
   /**
 161  
    * Set the region.
 162  
    *
 163  
    * @param region the region
 164  
    */
 165  
   void setRegion(String region);
 166  
 
 167  
   /**
 168  
    * Get the street address.
 169  
    *
 170  
    * @return the street address
 171  
    */
 172  
   String getStreetAddress();
 173  
 
 174  
   /**
 175  
    * Set the street address.
 176  
    *
 177  
    * @param streetAddress the street address
 178  
    */
 179  
   void setStreetAddress(String streetAddress);
 180  
 
 181  
   /**
 182  
    * Get the type of label of the address.
 183  
    *
 184  
    * @return the type or label of the address
 185  
    */
 186  
   String getType();
 187  
 
 188  
   /**
 189  
    * Get the type of label of the address.
 190  
    *
 191  
    * @param type the type of label of the address.
 192  
    */
 193  
   void setType(String type);
 194  
 
 195  
   /**
 196  
    * Get the formatted address.
 197  
    *
 198  
    * @return the formatted address
 199  
    */
 200  
   String getFormatted();
 201  
 
 202  
   /**
 203  
    * Set the formatted address.
 204  
    *
 205  
    * @param formatted the formatted address
 206  
    */
 207  
   void setFormatted(String formatted);
 208  
 
 209  
   /**
 210  
    * <p>
 211  
    * Get a Boolean value indicating whether this instance of the Plural Field is the primary or
 212  
    * preferred value of for this field, e.g. the preferred mailing address. Service Providers MUST
 213  
    * NOT mark more than one instance of the same Plural Field as primary="true", and MAY choose not
 214  
    * to mark any fields as primary, if this information is not available. Introduced in v0.8.1
 215  
    * </p><p>
 216  
    * The service provider may wish to share the address instance between items and primary related
 217  
    * to the address from which this came, so if the address came from an Organization, primary
 218  
    * relates to the primary address of the organization, and not necessary the primary address of
 219  
    * all addresses.
 220  
    * </p><p>
 221  
    * If the address is not part of a list (eg Person.location ) primary has no meaning.
 222  
    * <p>
 223  
    * @return true if the instance if the primary instance.
 224  
    */
 225  
   Boolean getPrimary();
 226  
 
 227  
   /**
 228  
    * @see Address.getPrimary()
 229  
    * @param primary set the Primary status of this Address.
 230  
    */
 231  
   void setPrimary(Boolean primary);
 232  
 }