當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。