Line data Source code
1 : // Copyright (C) 2014 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.common; 16 : 17 : import java.util.Objects; 18 : 19 : /** 20 : * Representation of an avatar in the REST API. 21 : * 22 : * <p>This class determines the JSON format of avatars in the REST API. 23 : * 24 : * <p>An avatar is the graphical representation of a user. 25 : */ 26 1 : public class AvatarInfo { 27 : /** 28 : * Size in pixels the UI prefers an avatar image to be. 29 : * 30 : * <p>The web UI prefers avatar images to be square, both the height and width of the image should 31 : * be this size. The height is the more important dimension to match than the width. 32 : */ 33 : public static final int DEFAULT_SIZE = 32; 34 : 35 : /** The URL to the avatar image. */ 36 : public String url; 37 : 38 : /** The height of the avatar image in pixels. */ 39 : public Integer height; 40 : 41 : /** The width of the avatar image in pixels. */ 42 : public Integer width; 43 : 44 : @Override 45 : public boolean equals(Object o) { 46 0 : if (o instanceof AvatarInfo) { 47 0 : AvatarInfo avatarInfo = (AvatarInfo) o; 48 0 : return Objects.equals(url, avatarInfo.url) 49 0 : && Objects.equals(height, avatarInfo.height) 50 0 : && Objects.equals(width, avatarInfo.width); 51 : } 52 0 : return false; 53 : } 54 : 55 : @Override 56 : public int hashCode() { 57 0 : return Objects.hash(url, height, width); 58 : } 59 : }