2 * Copyright 2007 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.client.result;
20 * Represents a result that encodes an e-mail address, either as a plain address
21 * like "joe@example.org" or a mailto: URL like "mailto:joe@example.org".
23 * @author srowen@google.com (Sean Owen)
25 public final class EmailAddressResult extends AbstractDoCoMoResult {
27 private final String emailAddress;
29 public EmailAddressResult(String rawText) {
30 super(ParsedReaderResultType.EMAIL_ADDRESS);
31 if (rawText.startsWith("mailto:")) {
32 // If it starts with mailto:, assume it is definitely trying to be an email address
33 emailAddress = rawText.substring(7);
35 if (!EmailDoCoMoResult.isBasicallyValidEmailAddress(rawText)) {
36 throw new IllegalArgumentException("Invalid email address: " + rawText);
38 emailAddress = rawText;
42 public String getEmailAddress() {
46 public String getDisplayResult() {