Package org.nutz.lang.meta

Examples of org.nutz.lang.meta.Email


public class String2Email extends Castor<String, Email> {

    @Override
    public Email cast(String src, Class<?> toType, String... args) {
        return new Email(src);
    }
View Full Code Here


        this.name = name;
    }

    public Person(String name, String email, int fatherId, int managerId, String masterName) {
        this.name = name;
        this.email = new Email(email);
        this.fatherId = fatherId;
        this.managerId = managerId;
        this.masterName = masterName;
    }
View Full Code Here

    public void testString2int() throws FailToCastObjectException {
        assertEquals(45, (int) Castors.me().castTo("45", int.class));
    }

    public void testString2Email() throws FailToCastObjectException {
        Email em = new Email("zozoh@263.net");
        assertEquals(em, "zozoh@263.net");
    }
View Full Code Here

        assertTrue(Arrays.equals(inAry, reAry));
    }

    @Test
    public void testArray2String() throws Exception {
        Email[] mails = {new Email("zzh@263.net"),
                         new Email("zozohtnt@yahoo.com.cn")};
        String done = Castors.me().castToString(mails);
        Email[] mails2 = Castors.me().castTo(done, Email[].class);
        assertTrue(Lang.equals(mails, mails2));
    }
View Full Code Here

    }

    @Test
    public void testString2Array() throws Exception {
        String orgs = "zzh@263.net,zozohtnt@yahoo.com.cn";
        Email[] exp = {new Email("zzh@263.net"),
                       new Email("zozohtnt@yahoo.com.cn")};
        Email[] done = Castors.me().castTo(orgs, Email[].class);
        assertTrue(Arrays.equals(exp, done));
    }
View Full Code Here

        assertEquals("B", d.args[1]);
    }

    @Test
    public void testBornEmail() {
        Email email = Mirror.me(Email.class).born("a@b.com");
        assertEquals("a", email.getAccount());
        assertEquals("b.com", email.getHost());

        email = Mirror.me(Email.class).born();
        email.setAccount("a");
        email.setHost("b.com");
        assertEquals("a", email.getAccount());
        assertEquals("b.com", email.getHost());
    }
View Full Code Here

     */
    public static final boolean isEmail(CharSequence input) {
        if (Strings.isBlank(input))
            return false;
        try {
            new Email(input.toString());
            return true;
        }
        catch (Exception e) {}
        return false;
    }
View Full Code Here

TOP

Related Classes of org.nutz.lang.meta.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.