Sha256: 7ec629f1f23f7c0a166763316904d476ccc5bf19c192566df33f1d3b0fc7d64e

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

package <%= models_package %>;
<% if options[:remote_users] -%>

import java.util.Collections;
import java.util.List;
<% end -%>

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;

import org.fusesource.restygwt.client.Json;
import org.fusesource.restygwt.client.Json.Style;

import <%= gwt_rails_package %>.models.IsUser;

@Json(style = Style.RAILS)
public class User implements IsUser {

  private String login;

  private String name;
<% if options[:remote_users] -%>

  public final List<Application> applications;
<% end -%>

  @JsonCreator
  public User(@JsonProperty("login") String login,
          @JsonProperty("name") String name<% if options[:remote_users] -%>, 
          @JsonProperty("applications") List<Application> applications<% end -%>){
    this.login = login;
    this.name = name;
<% if options[:remote_users] -%>
    this.applications = applications == null ? null : Collections.unmodifiableList(applications);
<% end -%>
  }
  
  public String getLogin(){
    return login;
  }

  public String getName(){
    return name;
  }

  public int hashCode(){
      return login.hashCode();
  }

  public boolean equals(Object other){
    return (other instanceof User) && 
        ((User)other).login == login;
  }

}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resty-generators-0.7.3 lib/generators/resty/setup/templates/User.java