📄 photodataimpl.java
字号:
/* Copyright (c) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.google.gdata.data.photos.impl;import com.google.gdata.data.ExtensionDescription;import com.google.gdata.data.ExtensionPoint;import com.google.gdata.data.ExtensionProfile;import com.google.gdata.data.geo.Point;import com.google.gdata.data.geo.impl.PointDataImpl;import com.google.gdata.data.media.mediarss.MediaGroup;import com.google.gdata.data.media.mediarss.MediaKeywords;import com.google.gdata.data.photos.ExifTags;import com.google.gdata.data.photos.Namespaces;import com.google.gdata.data.photos.PhotoData;import com.google.gdata.data.photos.impl.Extensions.GphotoAlbumId;import com.google.gdata.data.photos.impl.Extensions.GphotoCommentCount;import com.google.gdata.data.photos.impl.Extensions.GphotoCommentsEnabled;import com.google.gdata.data.photos.impl.Extensions.GphotoConstruct;import com.google.gdata.data.photos.impl.Extensions.GphotoTimestamp;import com.google.gdata.data.photos.impl.Extensions.GphotoVersion;import com.google.gdata.data.photos.pheed.PheedImageUrl;import com.google.gdata.data.photos.pheed.PheedThumbnail;import com.google.gdata.data.photos.pheed.PheedVideoUrl;import com.google.gdata.util.ParseException;import java.util.ArrayList;import java.util.Date;import java.util.List;/** * Implementation class for photo data objects. This class takes an * {@link ExtensionPoint} and uses it to provide all of the methods that * {@link PhotoData} specifies. These methods are handled by using * extension classes to retrieve or set extensions of the appropriate type. * * */public class PhotoDataImpl extends GphotoDataImpl implements PhotoData { private PointDataImpl geoData; /** * Construct a new implementation of PhotoGphotoData with the given extension * point as the backing storage for data. */ public PhotoDataImpl(ExtensionPoint extensionPoint) { super(extensionPoint); geoData = new PointDataImpl(extensionPoint); } /* * Declare all of the extensions on the photo data. */ @Override public void declareExtensions(ExtensionProfile extProfile) { declare(extProfile, PheedThumbnail.getDefaultDescription()); declare(extProfile, PheedImageUrl.getDefaultDescription()); declare(extProfile, GphotoVersion.getDefaultDescription()); declare(extProfile, GphotoPosition.getDefaultDescription()); declare(extProfile, GphotoWidth.getDefaultDescription()); declare(extProfile, GphotoHeight.getDefaultDescription()); declare(extProfile, GphotoRotation.getDefaultDescription()); declare(extProfile, GphotoSize.getDefaultDescription()); declare(extProfile, GphotoAlbumId.getDefaultDescription()); declare(extProfile, GphotoClient.getDefaultDescription()); declare(extProfile, GphotoChecksum.getDefaultDescription()); declare(extProfile, GphotoTimestamp.getDefaultDescription()); declare(extProfile, GphotoExifTime.getDefaultDescription()); declare(extProfile, GphotoStreamId.getDefaultDescription()); declare(extProfile, ExifTags.getDefaultDescription()); new ExifTags().declareExtensions(extProfile); declare(extProfile, GphotoCommentsEnabled.getDefaultDescription()); declare(extProfile, GphotoCommentCount.getDefaultDescription()); declareMediaExtensions(extProfile); geoData.declareExtensions(extProfile); } /** * Get the video url for the video that is being pointed at. */ public String getVideoUrl() { return getSimpleValue(GphotoVideoUrl.class); } /** * Set the video url that points to the url of the actual video. * PheedVideoUrl is deprecated but included for backwards compatibility with * older clients. */ public void setVideoUrl(String videoUrl) { if (videoUrl != null) { setExtension(new GphotoVideoUrl(videoUrl)); setExtension(new PheedVideoUrl(videoUrl)); } else { removeExtension(GphotoVideoUrl.class); removeExtension(PheedVideoUrl.class); } } /** * @return the gphoto:version on the item. */ public Long getVersion() throws ParseException { return getLongValue(GphotoVersion.class); } /** * Set the version of the photo this item is about. * * @param version the version of the photo. */ public void setVersion(Long version) { if (version != null) { setExtension(new GphotoVersion(version)); } else { removeExtension(GphotoVersion.class); } } /** * @return the gphoto:position of the photo. */ public Float getPosition() throws ParseException { return getFloatValue(GphotoPosition.class); } /** * Set the position of the photo this item is about. This is the photo's * position in the album it is in (in the context of the feed). * * @param position the position of the photo in the album. */ public void setPosition(Float position) { if (position != null) { setExtension(new GphotoPosition(position)); } else { removeExtension(GphotoPosition.class); } } /** * @return the gphoto:albumId of the photo. */ public String getAlbumId() { return getSimpleValue(GphotoAlbumId.class); } /** * Sets the album the photo is in. */ public void setAlbumId(String albumId) { if (albumId != null) { setExtension(new GphotoAlbumId(albumId)); } else { removeExtension(GphotoAlbumId.class); } } /** * Sets the album the photo is in. */ public void setAlbumId(Long albumId) { if (albumId != null) { setExtension(new GphotoAlbumId(albumId)); } else { removeExtension(GphotoAlbumId.class); } } /** * @return the gphoto:width of the photo. */ public Long getWidth() throws ParseException { return getLongValue(GphotoWidth.class); } /** * Set the width of the photo this item is about. * * @param width the width of the photo. */ public void setWidth(Long width) { if (width != null) { setExtension(new GphotoWidth(width)); } else { removeExtension(GphotoWidth.class); } } /** * @return the gphoto:height of the photo. */ public Long getHeight() throws ParseException { return getLongValue(GphotoHeight.class); } /** * Set the height of the photo the item is about. * * @param height the height of the photo. */ public void setHeight(Long height) { if (height != null) { setExtension(new GphotoHeight(height)); } else { removeExtension(GphotoHeight.class); } } /** * @return the gphoto:rotation of the photo. */ public Integer getRotation() throws ParseException { return getIntegerValue(GphotoRotation.class); } /** * Set the rotation in degrees of the photo. * * @param rotation the rotation of the photo. */ public void setRotation(Integer rotation) { if (rotation != null) { setExtension(new GphotoRotation(rotation)); } else { removeExtension(GphotoRotation.class); } } /** * @return the gphoto:size of the photo. */ public Long getSize() throws ParseException { return getLongValue(GphotoSize.class); } /** * Set the size of the photo this item is about. * * @param size the size of the photo. */ public void setSize(Long size) { if (size != null) { setExtension(new GphotoSize(size)); } else { removeExtension(GphotoSize.class); } } /** * @return the gphoto:client of the photo. */ public String getClient() { return getSimpleValue(GphotoClient.class); } /** * Set the client of the photo this item is about. * * @param client the client that created the photo. */ public void setClient(String client) { if (client != null) { setExtension(new GphotoClient(client)); } else { removeExtension(GphotoClient.class); } } /** * @return the gphoto:checksum of the photo. */ public String getChecksum() { return getSimpleValue(GphotoChecksum.class); } /** * Set the checksum of the photo this item is about. * * @param checksum the checksum on the photo. */ public void setChecksum(String checksum) { if (checksum != null) { setExtension(new GphotoChecksum(checksum)); } else { removeExtension(GphotoChecksum.class); } } /** * @return the gphoto:timestamp of the photo. */ public Date getTimestamp() throws ParseException { return getDateValue(GphotoTimestamp.class); } /** * Set the timestamp on the photo this item is about. * * @param timestamp the timestamp on the photo. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -