当前位置: 首页>>代码示例>>Java>>正文


Java Person类代码示例

本文整理汇总了Java中net.sourceforge.stripes.examples.bugzooky.biz.Person的典型用法代码示例。如果您正苦于以下问题:Java Person类的具体用法?Java Person怎么用?Java Person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Person类属于net.sourceforge.stripes.examples.bugzooky.biz包,在下文中一共展示了Person类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveChanges

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
@HandlesEvent("Save")
public Resolution saveChanges() {
    PersonManager pm = new PersonManager();

    // Save any changes to existing people (and create new ones)
    for (Person person : people) {
        pm.saveOrUpdate(person);
    }

    // Then, if the user checked anyone off to be deleted, delete them
    if (deleteIds != null) {
        for (int id : deleteIds) {
            pm.deletePerson(id);
        }
    }

    return new RedirectResolution(getClass());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:19,代码来源:AdministerPeopleActionBean.java

示例2: convert

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/**
 * Attempt to parse the input string to an integer and look up the {@link Person} with that ID
 * using a {@link PersonManager}.
 * 
 * @param input The input string to be parsed as the Person ID.
 * @param targetType The type of object we're supposed to be returning.
 * @param errors The validation errors for this request. If the input string cannot be parsed,
 *            then we will add a new {@link ValidationError} to this collection and return null.
 */
public Person convert(String input, Class<? extends Person> targetType,
        Collection<ValidationError> errors) {
    Person person = null;

    try {
        int id = Integer.valueOf(input);
        PersonManager personManager = new PersonManager();
        person = personManager.getPerson(id);
    }
    catch (NumberFormatException e) {
        errors.add(new SimpleError("The number {0} is not a valid Person ID", input));
    }

    return person;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:25,代码来源:PersonTypeConverter.java

示例3: getPeople

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/**
 * If no list of people is set and we're not handling the "save" event then populate the list of
 * people and return it.
 */
public List<Person> getPeople() {
    if (people == null && !"Save".equals(getContext().getEventName())) {
        people = new PersonManager().getAllPeople();
    }

    return people;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:12,代码来源:AdministerPeopleActionBean.java

示例4: setUser

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** The user being registered. */
public void setUser(Person user) { this.user = user; }
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:3,代码来源:RegisterActionBean.java

示例5: getUser

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** The user being registered. */
public Person getUser() { return user; }
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:3,代码来源:RegisterActionBean.java

示例6: setPeople

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
public void setPeople(List<Person> people) {
    this.people = people;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:4,代码来源:AdministerPeopleActionBean.java

示例7: format

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Format the {@link Person} object according to the format type and pattern. */
public String format(Person person) {
    if (person == null) {
        return "";
    }
    else if ("short".equals(formatType)) {
        return checkNull(person.getUsername());
    }
    else if ("full".equals(formatType)) {
        Pattern pattern = Pattern.compile("%[EFLU]");
        String fp = formatPattern == null ? DEFAULT_FORMAT_PATTTERN : formatPattern;

        StringBuffer buf = new StringBuffer();
        Matcher matcher = pattern.matcher(fp);
        while (matcher.find()) {
            char spec = matcher.group().charAt(1);
            switch (spec) {
            case 'E':
                matcher.appendReplacement(buf, checkNull(person.getEmail()));
                break;
            case 'F':
                matcher.appendReplacement(buf, checkNull(person.getFirstName()));
                break;
            case 'L':
                matcher.appendReplacement(buf, checkNull(person.getLastName()));
                break;
            case 'U':
                matcher.appendReplacement(buf, checkNull(person.getUsername()));
                break;
            default:
                buf.append(matcher.group());
            }
        }
        matcher.appendTail(buf);

        return buf.toString();
    }
    else {
        return String.valueOf(person.getId());
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:42,代码来源:PersonFormatter.java

示例8: getUser

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Gets the currently logged in user, or null if no-one is logged in. */
public Person getUser() {
    return (Person) getRequest().getSession().getAttribute("user");
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:BugzookyActionBeanContext.java

示例9: setUser

import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Sets the currently logged in user. */
public void setUser(Person currentUser) {
    getRequest().getSession().setAttribute("user", currentUser);
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:BugzookyActionBeanContext.java


注:本文中的net.sourceforge.stripes.examples.bugzooky.biz.Person类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。