javax.mail.Address.getType()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(145)

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

Address.getType介绍

[英]Return a type string that identifies this address type.
[中]返回标识此地址类型的类型字符串。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: camunda/camunda-bpm-platform

if (protocols.containsKey(addresses[i].getType())) {
List<Address> v = protocols.get(addresses[i].getType());
v.add(addresses[i]);
} else {
protocols.put(addresses[i].getType(), w);

代码示例来源:origin: com.sun.mail/javax.mail

if (protocols.containsKey(addresses[i].getType())) {
List<Address> v = protocols.get(addresses[i].getType());
v.add(addresses[i]);
} else {
protocols.put(addresses[i].getType(), w);

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

List<Address> addresses = getAddressesFromStream(); // populate this list with all your Address objects
 // now populate the HashMap
 Map<String, List<Address>> typeMap = new HashMap<String, List<Address>>();
 for (Address address: addresses) {
   String type;
   if (StringUtils.isBlank(address.getType())) {
     type = "EMPTY";
   } else {
     type = address.getType();
   }
   List<Address> group;
   if (!typeMap.containsKey(type)) {
     group = new ArrayList<Address>();
     typeMap.put(type, group);
   }
   group = typeMap.get(type);
   group.add(address);         
 }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * Get a Transport object that can transport a Message to the
 * specified address type.
 *
 * @param    address
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol == null) {
  throw new NoSuchProviderException("No provider for Address type: "+
           address.getType());
} else {
  return getTransport(transportProtocol);
}
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: javax.mail/javax.mail-api

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: jboss/jboss-javaee-specs

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: com.sun.mail/mailapi

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: org.glassfish.metro/webservices-extra

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Get a Transport object that can transport a Message of the
 * specified address type.
 *
 * @param    address    an address for which a Transport is needed
 * @return    A Transport object
 * @see javax.mail.Address
 * @exception    NoSuchProviderException If provider for the 
 *            Address type is not found
 */
public Transport getTransport(Address address) 
                   throws NoSuchProviderException {
String transportProtocol;
transportProtocol =
  getProperty("mail.transport.protocol." + address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
transportProtocol = (String)addressMap.get(address.getType());
if (transportProtocol != null)
  return getTransport(transportProtocol);
throw new NoSuchProviderException("No provider for Address type: "+
          address.getType());
}

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

Person person = personRepository.find(personId);
for (Address address : person.getAddresses()) {
 if ("CONTACT_ADDRESS".equals(address.getType()) {
  address.setCity("London");
 }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Return a transport for the protocol associated with the type of this address.
 *
 * @param address the address we are trying to deliver to
 * @return a Transport
 * @throws NoSuchProviderException
 */
public Transport getTransport(Address address) throws NoSuchProviderException {
  String type = address.getType();
  // load the address map from the resource files.
  Map addressMap = getAddressMap();
  String protocolName = (String)addressMap.get(type);
  if (protocolName == null) {
    throw new NoSuchProviderException("No provider for address type " + type);
  }
  return getTransport(protocolName);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Return a transport for the protocol associated with the type of this address.
 *
 * @param address the address we are trying to deliver to
 * @return a Transport
 * @throws NoSuchProviderException
 */
public Transport getTransport(Address address) throws NoSuchProviderException {
  String type = address.getType();
  // load the address map from the resource files.
  Map addressMap = getAddressMap();
  String protocolName = (String)addressMap.get(type);
  if (protocolName == null) {
    throw new NoSuchProviderException("No provider for address type " + type);
  }
  return getTransport(protocolName);
}

代码示例来源:origin: com.gitlab.jhonsapp/simple-email

public static List<InternetAddress> getInternetAddressses(Address[] addresses) throws InvalidAddressException {
  List<InternetAddress> result = new ArrayList<InternetAddress>();
  if (addresses != null) {
    for (Address a : addresses) {
      if (a.getType().equals("rfc822")) {
        try {
          result.add(new InternetAddress(a.toString()));
        }
        catch (AddressException e) {
          throw new InvalidAddressException(e);
        }
      }
      else {
        throw new InvalidAddressException("Not type RFC822");
      }
    }
  }
  return result;
}

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

List<Map<String, Object>> resultsList = new ArrayList<Map<String, Object>>();
List<Person> persons = criteria.list();

for (Person person: persons) {
  resultsList.put("name", person.getName());
  resultsList.put("surname", person.getSurname());
  List<Map<Strin, Object>> addressesList = new ArrayList<Map<Strin, Object>>();
  for(Address address: person.getAddresses()) {
    addressesList.put("city", address.getCity());
    addressesList.put("street", address.getStreet());
    addressesList.put("type", address.getType());   
  }
  resultsList.put("name", person.ngetName());
}

代码示例来源:origin: actframework/actframework

if (null != aa) {
  for (Address a: aa) {
    lines.add(a.getType() + ":" + a.toString());

代码示例来源:origin: org.nhind/direct-common

recipHeaders.addHeader(DSNStandard.Headers.FinalRecipient, finalRecipient.getType()
 + ";" + finalRecipient.toString());

相关文章