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


Java TeeShirtSize类代码示例

本文整理汇总了Java中com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize的典型用法代码示例。如果您正苦于以下问题:Java TeeShirtSize类的具体用法?Java TeeShirtSize怎么用?Java TeeShirtSize使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TeeShirtSize类属于com.google.devrel.training.conference.form.ProfileForm包,在下文中一共展示了TeeShirtSize类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUpdateProfile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
@Test
public void testUpdateProfile() throws Exception {
    // Save for the first time.
    conferenceApi.saveProfile(user, new ProfileForm(DISPLAY_NAME, TEE_SHIRT_SIZE));
    Profile profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(TEE_SHIRT_SIZE, profile.getTeeShirtSize());
    assertEquals(DISPLAY_NAME, profile.getDisplayName());
    // Then try to update it.
    String newDisplayName = "New Name";
    TeeShirtSize newTeeShirtSize = TeeShirtSize.L;
    conferenceApi.saveProfile(user, new ProfileForm(newDisplayName, newTeeShirtSize));
    profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(newTeeShirtSize, profile.getTeeShirtSize());
    assertEquals(newDisplayName, profile.getDisplayName());
}
 
开发者ID:udacity,项目名称:ud859,代码行数:20,代码来源:ConferenceApiTest.java

示例2: testUpdateProfile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
@Test
public void testUpdateProfile() throws Exception {
    // Save for the first time.
    conferenceApi.saveProfile(user, new ProfileForm(DISPLAY_NAME, TEE_SHIRT_SIZE));
    Profile profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(TEE_SHIRT_SIZE, profile.getTeeShirtSize());
    assertEquals(DISPLAY_NAME, profile.getDisplayName());
    // Then try to update it.
    String newDisplayName = "Kay's Daddy";
    TeeShirtSize newTeeShirtSize = TeeShirtSize.L;
    conferenceApi.saveProfile(user, new ProfileForm(newDisplayName, newTeeShirtSize));
    profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(newTeeShirtSize, profile.getTeeShirtSize());
    assertEquals(newDisplayName, profile.getDisplayName());
}
 
开发者ID:udacity,项目名称:ud859,代码行数:20,代码来源:ConferenceApiTest.java

示例3: testUpdate

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
    String newDisplayName = "New Display Name";
    TeeShirtSize newTeeShirtSize = TeeShirtSize.M;
    profile.update(newDisplayName, newTeeShirtSize);
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(newDisplayName, profile.getDisplayName());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(newTeeShirtSize, profile.getTeeShirtSize());
}
 
开发者ID:udacity,项目名称:ud859,代码行数:11,代码来源:ProfileTest.java

示例4: update

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Update the Profile with the given displayName and teeShirtSize
 *
 * @param displayName
 * @param teeShirtSize
 */
public void update(String displayName, TeeShirtSize teeShirtSize) {
    if (displayName != null) {
        this.displayName = displayName;
    }
    if (teeShirtSize != null) {
        this.teeShirtSize = teeShirtSize;
    }
}
 
开发者ID:udacity,项目名称:ud859,代码行数:15,代码来源:Profile.java

示例5: update

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Update the Profile with the given displayName and teeShirtSize
 * @param displayName
 * @param teeShirtSize
 */
public void update(String displayName, TeeShirtSize teeShirtSize) {
    if (displayName != null) {
        this.displayName = displayName;
    }
    if (teeShirtSize != null) {
        this.teeShirtSize = teeShirtSize;
    }
}
 
开发者ID:udacity,项目名称:ud859,代码行数:14,代码来源:Profile.java

示例6: testUpdate

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
    String newDisplayName = "Kay's Daddy";
    TeeShirtSize newTeeShirtSize = TeeShirtSize.M;
    profile.update(newDisplayName, newTeeShirtSize);
    assertEquals(USER_ID, profile.getUserId());
    assertEquals(newDisplayName, profile.getDisplayName());
    assertEquals(EMAIL, profile.getMainEmail());
    assertEquals(newTeeShirtSize, profile.getTeeShirtSize());
}
 
开发者ID:udacity,项目名称:ud859,代码行数:11,代码来源:ProfileTest.java

示例7: update

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
public void update(String displayName, TeeShirtSize teeShirtSize) {
	if (displayName != null) {
		this.displayName = displayName;
	} if (teeShirtSize != null) {
		this.teeShirtSize = teeShirtSize;
	}
}
 
开发者ID:DawoonC,项目名称:dw-scalable,代码行数:8,代码来源:Profile.java

示例8: saveProfile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Creates or updates a Profile object associated with the given user
 * object.
 *
 * @param user
 *            A User object injected by the cloud endpoints.
 * @param profileForm
 *            A ProfileForm object sent from the client form.
 * @return Profile object just created.
 * @throws UnauthorizedException
 *             when the User object is null.
 */

   // Declare this method as a method available externally through Endpoints
@ApiMethod(name = "saveProfile", path = "profile", httpMethod = HttpMethod.POST)

// The request that invokes this method should provide data that
// conforms to the fields defined in ProfileForm

// TODO 1 Pass the ProfileForm parameter
// TODO 2 Pass the User parameter
public Profile saveProfile(final User user, ProfileForm profileForm)
		throws UnauthorizedException {

	String userId = "";
	String mainEmail = "";
	String displayName = "Your name will go here";
	TeeShirtSize teeShirtSize = TeeShirtSize.NOT_SPECIFIED;

	// TODO 2
	// If the user is not logged in, throw an UnauthorizedException
	if (user == null) {
           throw new UnauthorizedException("Authorization required");
       }

	// TODO 1
    // Set the teeShirtSize to the value sent by the ProfileForm, if sent
       // otherwise leave it as the default value
	 if (profileForm.getTeeShirtSize() != null) {
		 teeShirtSize = profileForm.getTeeShirtSize();
	 }

	// TODO 1
       // Set the displayName to the value sent by the ProfileForm, if sent
       // otherwise set it to null
	displayName = profileForm.getDisplayName();
	
	// TODO 2
	// Get the userId and mainEmail
	mainEmail = user.getEmail();
	userId = user.getUserId();

       // TODO 2
       // If the displayName is null, set it to the default value based on the user's email
       // by calling extractDefaultDisplayNameFromEmail(...)
	 if (displayName == null) {
	   displayName = extractDefaultDisplayNameFromEmail(user.getEmail());
	   }

	// Create a new Profile entity from the
	// userId, displayName, mainEmail and teeShirtSize
	Profile profile = new Profile(userId, displayName, mainEmail, teeShirtSize);

	// TODO 3 (In lesson 3)
	// Save the entity in the datastore

	// Return the profile
	return profile;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:70,代码来源:ConferenceApi.java

示例9: getTeeShirtSize

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
public TeeShirtSize getTeeShirtSize() {
	return teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:4,代码来源:Profile.java

示例10: getTeeShirtSize

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
public TeeShirtSize getTeeShirtSize() {
    return teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:4,代码来源:Profile.java

示例11: saveProfile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Creates or updates a Profile object associated with the given user
 * object.
 *
 * @param user
 *            A User object injected by the cloud endpoints.
 * @param profileForm
 *            A ProfileForm object sent from the client form.
 * @return Profile object just created.
 * @throws UnauthorizedException
 *             when the User object is null.
 */

// Declare this method as a method available externally through Endpoints
@ApiMethod(name = "saveProfile", path = "profile", httpMethod = HttpMethod.POST)
// The request that invokes this method should provide data that
// conforms to the fields defined in ProfileForm

// TODO 1 Pass the ProfileForm parameter
// TODO 2 Pass the User parameter
public Profile saveProfile() throws UnauthorizedException {

    String userId = null;
    String mainEmail = null;
    String displayName = "Your name will go here";
    TeeShirtSize teeShirtSize = TeeShirtSize.NOT_SPECIFIED;

    // TODO 2
    // If the user is not logged in, throw an UnauthorizedException

    // TODO 1
    // Set the teeShirtSize to the value sent by the ProfileForm, if sent
    // otherwise leave it as the default value

    // TODO 1
    // Set the displayName to the value sent by the ProfileForm, if sent
    // otherwise set it to null

    // TODO 2
    // Get the userId and mainEmail

    // TODO 2
    // If the displayName is null, set it to default value based on the user's email
    // by calling extractDefaultDisplayNameFromEmail(...)

    // Create a new Profile entity from the
    // userId, displayName, mainEmail and teeShirtSize
    Profile profile = new Profile(userId, displayName, mainEmail, teeShirtSize);

    // TODO 3 (In Lesson 3)
    // Save the Profile entity in the datastore

    // Return the profile
    return profile;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:56,代码来源:ConferenceApi.java

示例12: Profile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Public constructor for Profile.
 * @param userId The user id, obtained from the email
 * @param displayName Any string user wants us to display him/her on this system.
 * @param mainEmail User's main e-mail address.
 * @param teeShirtSize The User's tee shirt size
 * 
 */
public Profile (String userId, String displayName, String mainEmail, TeeShirtSize teeShirtSize) {
	this.userId = userId;
	this.displayName = displayName;
	this.mainEmail = mainEmail;
	this.teeShirtSize = teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:15,代码来源:Profile.java

示例13: Profile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Public constructor for Profile.
 * @param userId The user id, obtained from the email
 * @param displayName Any string user wants us to display him/her on this system.
 * @param mainEmail User's main e-mail address.
 * @param teeShirtSize The User's tee shirt size
 *
 */
public Profile (String userId, String displayName, String mainEmail, TeeShirtSize teeShirtSize) {
    this.userId = userId;
    this.displayName = displayName;
    this.mainEmail = mainEmail;
    this.teeShirtSize = teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:15,代码来源:Profile.java

示例14: Profile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Public constructor for Profile.
 * @param userId The datastore key.
 * @param displayName Any string user wants us to display him/her on this system.
 * @param mainEmail User's main e-mail address.
 * @param teeShirtSize User's teeShirtSize (Enum is in ProfileForm)
 */
public Profile(String userId, String displayName, String mainEmail, TeeShirtSize teeShirtSize) {
    this.userId = userId;
    this.displayName = displayName;
    this.mainEmail = mainEmail;
    this.teeShirtSize = teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:14,代码来源:Profile.java

示例15: Profile

import com.google.devrel.training.conference.form.ProfileForm.TeeShirtSize; //导入依赖的package包/类
/**
 * Public constructor for Profile.
 * @param userId The user id, obtained from the email
 * @param displayName Any string user wants us to display him/her on this system.
 * @param mainEmail User's main e-mail address.
 * @param teeShirtSize The User's tee shirt size
 * 
 */
public Profile (String userId, String displayName, String mainEmail, TeeShirtSize teeShirtSize) {
    this.userId = userId;
    this.displayName = displayName;
    this.mainEmail = mainEmail;
    this.teeShirtSize = teeShirtSize;
}
 
开发者ID:udacity,项目名称:ud859,代码行数:15,代码来源:Profile.java


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