Package org.dmlite.type.email

Examples of org.dmlite.type.email.Email


                throw new TypeException("Not a valid URL: "
                    + propertyStringValue + " ("
                    + conceptDotProperty + ")");
              }
            } else if (propertyClass == Email.class) {
              Email propertyEmailValue = Transformer
                  .email(propertyStringValue);
              if (propertyEmailValue != null) {
                entity.setProperty(propertyCode,
                    propertyEmailValue);
              } else {
View Full Code Here


              String fieldValue = Transformer
                  .string(fieldURLValue);
              element.addElement(propertyCode)
                  .addText(fieldValue);
            } else if (getObject instanceof Email) {
              Email fieldEmailValue = (Email) getObject;
              String fieldValue = Transformer
                  .string(fieldEmailValue);
              element.addElement(propertyCode)
                  .addText(fieldValue);
            } else {
View Full Code Here

              App.DATE_PATTERN);
        } else if (propertyClass == URL.class) {
          URL propertyValue = (URL) entity.getProperty(propertyCode);
          propertyValueText = Transformer.string(propertyValue);
        } else if (propertyClass == Email.class) {
          Email propertyValue = (Email) entity
              .getProperty(propertyCode);
          propertyValueText = Transformer.string(propertyValue);
        } else {
          Object propertyValue = entity.getProperty(propertyCode);
          if (propertyValue != null) {
            propertyValueText = propertyValue.toString();
          } else {
            propertyValueText = "????????";
          }
        }
      }
View Full Code Here

                    propertyConfig);
              }
            } else if (validationType
                .equals("org.dmlite.type.email.Email")) {
              String propertyValue = (String) property;
              Email email = Transformer.email(propertyValue);
              if (email == null) {
                validProperty = false;
                addPropertyTypeError(entities, entity,
                    propertyConfig);
              }
View Full Code Here

        } else if (propertyConfig.getPropertyClass().equals(
            "org.dmlite.type.email.Email")
            && propertyConfig.getDefaultValue() != null) {
          String propertyDefaultTextValue = propertyConfig
              .getDefaultValue();
          Email propertyDefaultValue = Transformer
              .email(propertyDefaultTextValue);
          if (propertyDefaultValue != null) {
            executeSetPropertyMethod(entity, propertyConfig,
                propertyDefaultValue);
          } else {
View Full Code Here

   *            email text
   * @return Email object if email is valid, null if not
   */
  public static Email email(String email) {
    try {
      return new Email(email);
    } catch (AddressException e) {
      return null;
    }
  }
View Full Code Here

          }
          externalLink = new ExternalLink("propertyValue", link,
              linkDisplayText);
          add(externalLink);
        } else if (propertyClass == Email.class) {
          Email email = (Email) property;
          if (email == null) {
            link = "";
          } else {
            link = email.toString();
          }
          if (displayText == null) {
            linkDisplayText = textExtractor
                .extractBeginPlusThreeDots(link,
                    App.SHORT_TEXT_LENGTH);
View Full Code Here

   *            source
   * @param targetClass
   *            target class
   */
  public Object convert(Object source, Class targetClass) {
    Email email = null;
    try {
      if (source != null) {
        if (targetClass == Email.class) {
          // from String to Email
          if (source instanceof Email) {
            email = (Email) source;
          } else if (source instanceof String) {
            String emailString = (String) source;
            if (emailString.equals("")) {
              return null;
            } else {
              email = Transformer.email(emailString);
              if (email == null) {
                throw new ConversionException("Not a valid Email: "
                    + source);
              }
            }
          } else {
            throw new ConversionException("Not a valid Email: "
                + source);
          }
        } else if (targetClass == String.class) {
          // from Email to String
          if (source instanceof String) {
            return source;
          } else if (source instanceof Email) {
            Email convertedEmail = (Email) source;
            String emailString = Transformer.string(convertedEmail);
            return emailString;
          } else {
            throw new ConversionException("Not a valid Email: "
                + source);
View Full Code Here

TOP

Related Classes of org.dmlite.type.email.Email

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.