All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qcloud.cos.model.Tag.TagSet Maven / Gradle / Ivy

/*
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 
 * According to cos feature, we modify some class,comment, field name, etc.
 */


package com.qcloud.cos.model.Tag;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class TagSet implements Serializable {
    private Map tags;
    
    /**
     * 

* Creates a new empty TagSet. *

* * @see TagSet#TagSet(Map) */ public TagSet() { this.tags = new HashMap( 1 ); } /** *

* Creates a new TagSet with the set of tags defined. *

* @param tags * A key/value mapping of tags to store in this TagSet */ public TagSet( Map tags ) { this.tags = new HashMap( 1 ); this.tags.putAll( tags ); } /** *

* Get the value of the tag with the given key. *

* @param key * The key of the tag to return * @return The value of the given tag. Will return null if no tag by the * given key exists. */ public String getTag( String key ) { return tags.get( key ); } /** *

* Sets the value of the tag for a given key. Will overwrite existing value. *

* @param key * The key for the tag * @param value * The value for the tag */ public void setTag( String key, String value ) { tags.put( key, value ); } /** *

* Get all the tags for this TagSet *

* @return A map of key/value for all tags */ public Map getAllTags() { return tags; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("{"); sb.append("Tags: " + this.getAllTags() ); sb.append("}"); return sb.toString(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy