Package com.google.gsoc.encoder

Source Code of com.google.gsoc.encoder.PersonPrimaryKeyEncoder

package com.google.gsoc.encoder;

import org.apache.tapestry5.ValueEncoder;

import com.google.gsoc.entity.Person;


public class PersonPrimaryKeyEncoder implements ValueEncoder<Person> {

  public String toClient(Person value) {
    if(value == null || value.getId() == null) {
      return "";
    }
    return value.getId().toString();
  }

  public Person toValue(String keyAsString) {
    Integer key = new Integer(keyAsString);
    Person person = Person.loadPerson(key);
    return person;
  }

}
TOP

Related Classes of com.google.gsoc.encoder.PersonPrimaryKeyEncoder

TOP
Copyright © 2018 www.massapi.com. 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.