org.uddi.api_v3.Address类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(14.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.uddi.api_v3.Address类的一些代码示例,展示了Address类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address类的具体详情如下:
包路径:org.uddi.api_v3.Address
类名称:Address

Address介绍

[英]##### 3.3.2.7 address

address represents the contact’s postal address, in a form suitable for addressing an envelope. The address structure is a simple list of address lines.

Attributes
Name 

Use 
xml:lang 

optional 
useType

optional
sortCode

optional
tModelKey

optional

Address structures have four optional attributes.

The xml:lang value describes the language the address is expressed in. There is no restriction on the number of addresses or what xml:lang value they may have. Publication of addresses in several languages, e.g. for use in multilingual countries, is supported. See Appendix D Internationalization for an example.

The useType describes the address’ type in unstructured text. Suggested examples include "headquarters", "sales office", "billing department", etc.

The sortCode attribute is deprecated because of the guarantee of preserving the document order (see Section 4.5.3Preservation of Document Order). In order to achieve this behavior, the data has just to be published in the desired order.

The tModelKey is a tModel reference that specifies that keyName keyValue pairs given by subsequent addressLine elements, if addressLine elements are present at all, are to be interpreted by the address structure associated with the tModel that is referenced. For a description of how to use tModels in order to give the addressLine list structure and meaning, see Appendix DInternationalization.

Java class for address complex type.

The following schema fragment specifies the expected content contained within this class.

<complexType name="address"> 
<complexContent> 
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 
<sequence> 
<element ref="{urn:uddi-org:api_v3}addressLine" maxOccurs="unbounded"/> 
</sequence> 
<attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/> 
<attribute name="useType" type="{urn:uddi-org:api_v3}useType" default="" /> 
<attribute name="sortCode" type="{urn:uddi-org:api_v3}sortCode" default="" /> 
<attribute name="tModelKey" type="{urn:uddi-org:api_v3}tModelKey" /> 
</restriction> 
</complexContent> 
</complexType>

[中]##### 3.3.2.7 address
地址表示联系人的邮政地址,其形式适合于信封的地址。地址结构是地址行的简单列表。
属性
名字
使用
xml:lang
可选的
使用类型
可选择的
排序码
可选择的
tModelKey
可选择的
地址结构有四个可选属性。
lang值描述了地址所用的语言。对地址的数量或它们可能具有的xml:lang值没有限制。支持以多种语言发布地址,例如供多语种国家使用。有关示例,请参见附录D。
useType用非结构化文本描述地址的类型。建议的示例包括“总部”、“销售办事处”、“计费部门”等。
sortCode属性已被弃用,因为可以保证保存文档顺序(请参见4.5.3节保存文档顺序)。为了实现这种行为,只需按所需的顺序发布数据。
tModelKey是一个tModel引用,它指定由后续addressLine元素给出的keyName-keyValue对(如果存在addressLine元素),将由与所引用tModel关联的地址结构来解释。有关如何使用tModels给出地址行列表结构和含义的说明,请参见附录D国际化。
地址复杂类型的Java类。
以下架构片段指定此类中包含的预期内容。

<complexType name="address"> 
<complexContent> 
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 
<sequence> 
<element ref="{urn:uddi-org:api_v3}addressLine" maxOccurs="unbounded"/> 
</sequence> 
<attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/> 
<attribute name="useType" type="{urn:uddi-org:api_v3}useType" default="" /> 
<attribute name="sortCode" type="{urn:uddi-org:api_v3}sortCode" default="" /> 
<attribute name="tModelKey" type="{urn:uddi-org:api_v3}tModelKey" /> 
</restriction> 
</complexContent> 
</complexType>

代码示例

代码示例来源:origin: stackoverflow.com

private String getCompleteAddressString(double LATITUDE, double LONGITUDE) {
     String strAdd = "";
     Geocoder geocoder = new Geocoder(this, Locale.getDefault());
     try {
       List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
       if (addresses != null) {
         Address returnedAddress = addresses.get(0);
         StringBuilder strReturnedAddress = new StringBuilder("");
         for (int i = 0; i < returnedAddress.getMaxAddressLineIndex(); i++) {
           strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
         }
         strAdd = strReturnedAddress.toString();
         Log.w("My Current loction address", "" + strReturnedAddress.toString());
       } else {
         Log.w("My Current loction address", "No Address returned!");
       }
     } catch (Exception e) {
       e.printStackTrace();
       Log.w("My Current loction address", "Canont get Address!");
     }
     return strAdd;
   }

代码示例来源:origin: stackoverflow.com

Thread thread = new Thread() {
  @Override public void run() {
    Geocoder geocoder = new Geocoder(context, Locale.getDefault());   
    String result = null;
    try {
      List<Address> list = geocoder.getFromLocation(
          location.getLatitude(), location.getLongitude(), 1);
      if (list != null && list.size() > 0) {
        Address address = list.get(0);
        result = address.getAddressLine(0) + ", " + address.getLocality();

代码示例来源:origin: stackoverflow.com

Geocoder gc = new Geocoder(ctx, Locale.getDefault());
List<Address> addresses;
addresses = gc.getFromLocation(lat, lng, 1);        
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) 
{
  Address address = addresses.get(0);
  for (int i = 0; i < address.getMaxAddressLineIndex(); i++)
     sb.append(address.getAddressLine(i)).append(",");
}

代码示例来源:origin: stackoverflow.com

Geocoder myLocation = new Geocoder(context, Locale.ENGLISH);
List<Address> myList= myLocation.getFromLocation(lat, lng, 1);
Address add = myList.get(0);
String addressString = add.getAddressLine(0);
String country = add.getCountryName();                      
String city = add.getLocality();

代码示例来源:origin: stackoverflow.com

Geocoder myLocation = new Geocoder(yourContext, Locale.getDefault());
List<Address> myList = myLocation.getFromLocation(Double.parseDouble(latitude),Double.parseDouble(longitude), 1);
Address address = (Address) myList.get(0);
String addressStr = "";
addressStr += address.getAddressLine(0) + ", ";
addressStr += address.getAddressLine(1) + ", ";
addressStr += address.getAddressLine(2);

代码示例来源:origin: stackoverflow.com

public void setLocation(Location loc) {
 //Get Human readable address from latitud and longitud coordinates 
 if (loc.getLatitude() != 0.0 && loc.getLongitude() != 0.0) {
  try {
   Geocoder geocoder = new Geocoder(this, Locale.getDefault());
   List<Address> list = geocoder.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1);
   if (!list.isEmpty()) {
  Address address = list.get(0);
  Log.d(CLASS_TAG, "Mi direcci—n es: \n" + address.getAddressLine(0));
   }
  } catch (IOException e) {
   e.printStackTrace();
  }
 }
}

代码示例来源:origin: stackoverflow.com

public static String getAddress(Context context ,String latitude , String longitude)
{

  Geocoder geocoder;
  List<Address> addressList;
  StringBuilder addressBuilder = new StringBuilder();

  geocoder = new Geocoder(context,Locale.getDefault());
  try{

    addressList = geocoder.getFromLocation(Double.valueOf(latitude),Double.valueOf(longitude),1);
    Address address = addressList.get(0);
    addressBuilder.append(address.getAddressLine(0)).append(",").append(address.getLocality()).append(",")
        .append(address.getAdminArea()).append(",").append(address.getCountryName()).append("||").append(address.getCountryName());

  }catch (Exception ex)
  {
    ex.printStackTrace();
  }

  return addressBuilder.toString();
}

代码示例来源:origin: stackoverflow.com

Geocoder geocoder = new Geocoder(context, Locale.getDefault());   
 String result = null;
 try {
   List<Address> list = geocoder.getFromLocation(
       location.getLatitude(), location.getLongitude(), 1);
   if (list != null && list.size() > 0) {
     Address address = list.get(0);
     // sending back first address line and locality
     result = address.getAddressLine(0) + ", " + address.getLocality();
   }
 } catch (IOException e) {
   Log.e(TAG, "Impossible to connect to Geocoder", e);
 }

代码示例来源:origin: stackoverflow.com

Geocoder geocoder = new Geocoder(context, Locale.getDefault());
Address address = geocoder.getFromLocation(lat, lng, 1);
Address obj = addresses.get(0);
latLng = new LatLng(obj.getLatitude(), obj.getLongitude());
final String addressText = String.format("%s, %s",obj.getMaxAddressLineIndex() > 0 ? obj.getAddressLine(0) : "",
              obj.getCountryName());

代码示例来源:origin: stackoverflow.com

public static Address searchLocationByName(Context context, String locationName){
  Geocoder geoCoder = new Geocoder(context, Locale.getDefault());
  GeoPoint gp = null;
  Address ad = null;
  try {
    List<Address> addresses = geoCoder.getFromLocationName(locationName, 1);
    for(Address address : addresses){
      gp = new GeoPoint((int)(address.getLatitude() * 1E6), (int)(address.getLongitude() * 1E6));
      address.getAddressLine(1);
      ad = address;
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return ad;
}

代码示例来源:origin: stackoverflow.com

locationManager.requestLocationUpdates(
       LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
   currentLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); //added by me
  //  Geocoder gcd = new Geocoder(location.this, Locale.getDefault());
   try{
     // Geocoder gcd = new Geocoder(location.this, Locale.getDefault());
     //List<Address> addresses = 
       // gcd.getFromLocation(currentLatitude, currentLongitude,100);
     List<Address> addresses = new Geocoder(location.this,Locale.getDefault()).getFromLocation(currentLocation.getLatitude(), currentLocation.getLongitude(), 1);          // changed
     StringBuilder result = new StringBuilder();
     if (addresses.size() > 0) {      
         Address address =  addresses.get(0);
         int maxIndex = address.getMaxAddressLineIndex();
         for (int x = 0; x <= maxIndex; x++ ){
           result.append(address.getAddressLine(x));
           //result.append(",");
         }                    
       }
       addressText.setText(result.toString()); 
       Intent send_add = new Intent();
       send_add.putExtra("address",result.toString());
   }
   catch(IOException ex){
 addressText.setText(ex.getMessage().toString());
 }

代码示例来源:origin: stackoverflow.com

pb.setVisibility(View.INVISIBLE);
  Toast.makeText(getBaseContext(),"Location changed : Lat: " +
          loc.getLatitude()+ " Lng: " + loc.getLongitude(),
      Toast.LENGTH_SHORT).show();
  String longitude = "Longitude: " +loc.getLongitude();
  Log.v(TAG, longitude);
  String latitude = "Latitude: " +loc.getLatitude();
 List<Address> addresses;
geocoder = new Geocoder(TabClubActivity.this, Locale.getDefault());
   addresses = geocoder.getFromLocation(latitude, longitude, 1); 
    StringBuilder strReturnedAddress = new StringBuilder("");
    for (int i = 0; i < returnedAddress.getMaxAddressLineIndex(); i++) {
      strReturnedAddress.append(returnedAddress.getAddressLine(i)).append(" ");

代码示例来源:origin: stackoverflow.com

Geocoder geocoder = new Geocoder(this.getActivity(), Locale.US);
try {
  addresses = geocoder.getFromLocation(mLastSeenMarker.getPosition().latitude,
      mLastSeenMarker.getPosition().longitude, 1);
    for (int i = 0; i < address.getMaxAddressLineIndex() - 1; i++) {
      if (!TextUtils.isEmpty(address.getAddressLine(i))) {
        addressStr += address.getAddressLine(i) + "\n";
    int lastIndex = address.getMaxAddressLineIndex() - 1;
    if (lastIndex >= 0 && lastIndex < address.getMaxAddressLineIndex()) {
      addressStr += address.getAddressLine(lastIndex);

代码示例来源:origin: stackoverflow.com

public static String reverseGeoCoder(Context mContext,double lat,double longi){
  try{
    Geocoder geoCoder = new Geocoder(mContext);
    List<Address> matches = geoCoder.getFromLocation(lat, longi, 1);
    Address bestMatch = (matches.isEmpty() ? null : matches.get(0));
    String address = bestMatch.getAddressLine(0)+" "+bestMatch.getAddressLine(1);
    return address;
  }
  catch(Exception e){
    e.printStackTrace();
  }
  return "";
}

代码示例来源:origin: stackoverflow.com

latitude = location.getLatitude();
longitude = location.getLongitude();
Geocoder geoCoder = new Geocoder(this);
  matches = geoCoder.getFromLocation(latitude, longitude, 1);
} catch (IOException e) {
    .getMaxAddressLineIndex() > 0 ? bestMatch.getAddressLine(0)
    : "", bestMatch.getLocality(), bestMatch.getCountryName());

代码示例来源:origin: stackoverflow.com

geocoder = new Geocoder(this);
        location.getLatitude(), location.getLongitude(),
        location.getAltitude(), location.getBearing());
    tv.setText(text);
      List<Address> addressList = geocoder.getFromLocation(
          location.getLatitude(), location.getLongitude(), 1);
        for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
          sb.append(address.getAddressLine(i)).append("\n");

代码示例来源:origin: stackoverflow.com

location.getLongitude(), location.getLatitude());
Toast.makeText(ShowActivity.this, message,
    Toast.LENGTH_LONG).show();
 List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 10); //<10>
 for (Address address : addresses) {
   System.out.println("my location .."+address.getAddressLine(0));
  acTextView.setText(address.getAddressLine(0));

代码示例来源:origin: org.apache.juddi/juddi-core-openjpa

public static void mapContactAddresses(List<org.apache.juddi.model.Address> modelAddressList,
   List<org.uddi.api_v3.Address> apiAddressList)
   throws DispositionReportFaultMessage {
    apiAddressList.clear();
    for (org.apache.juddi.model.Address modelAddress : modelAddressList) {
        org.uddi.api_v3.Address apiAddress = new org.uddi.api_v3.Address();
        apiAddress.setUseType(modelAddress.getUseType());
        apiAddress.setLang("");
        apiAddress.setSortCode(modelAddress.getSortCode());
        apiAddress.setTModelKey(modelAddress.getTmodelKey());
        mapAddressLines(modelAddress.getAddressLines(), apiAddress.getAddressLine());
        apiAddressList.add(apiAddress);
    }
}

代码示例来源:origin: org.apache.juddi/juddi-core

for (org.uddi.api_v3.Address address : addressList) {
    if (address != null) {
        validateSortCode(address.getSortCode());
        validateKeyLength(address.getTModelKey());
        validateLang(address.getLang());
        validateUseType(address.getUseType());
        boolean checked = true;
        if (address.getTModelKey() != null) {
            address.setTModelKey(address.getTModelKey().toLowerCase());
            validatedAddressLinesIfKeyDefined(address.getAddressLine());
            checked = verifyTModelKeyExistsAndChecked(address.getTModelKey(), config);
        if (address.getAddressLine() == null || address.getAddressLine().size() == 0) {
            throw new ValueNotAllowedException(new ErrorMessage("errors.contact.NoAddressLine"));
            validateAddressLines(address.getAddressLine(), config);

代码示例来源:origin: org.apache.juddi/juddi-client

private static List<Address> MapAddress(List<org.uddi.api_v3.Address> address) {
    List<Address> r = new ArrayList<Address>();
    if (address == null) {
        return r;
    }
    for (int i = 0; i < address.size(); i++) {
        Address x = new Address();
        x.setSortCode(address.get(i).getSortCode());
        x.setTModelKey(address.get(i).getTModelKey());
        x.setUseType(address.get(i).getUseType());
        x.getAddressLine().addAll(MapAddressLine(address.get(i).getAddressLine()));
        r.add(x);
    }
    return r;
}

相关文章