Exemple #1
0
 /**
  * Returns a tag list that has a copy of {@code tags}. Each tag value
  * is expected to be a string parseable using {@link BasicTag#parseTag}.
  */
 public static BasicTagList copyOf(IEnumerable <String> tags)
 {
     SmallTagMap.Builder builder = SmallTagMap.builder();
     foreach (var tag in tags)
     {
         builder.add(Tags.parseTag(tag));
     }
     return(new BasicTagList(builder.result()));
 }
Exemple #2
0
        /**
         * Returns a tag list that has a copy of {@code tags}.
         */
        public static BasicTagList copyOf(IDictionary <String, String> tags)
        {
            SmallTagMap.Builder builder = SmallTagMap.builder();
            foreach (var tag in tags)
            {
                builder.add(Tags.newTag(tag.Key, tag.Value));
            }

            return(new BasicTagList(builder.result()));
        }
Exemple #3
0
        /**
         * Returns a tag list from the list of key values passed.
         * <p/>
         * Example:
         * <p/>
         * <code>
         * BasicTagList tagList = BasicTagList.of("id", "someId", "class", "someClass");
         * </code>
         */
        public static BasicTagList of(params string[] tags)
        {
            //Preconditions.checkArgument(tags.Length % 2 == 0, "tags must be a sequence of key,value pairs");

            SmallTagMap.Builder builder = SmallTagMap.builder();
            for (int i = 0; i < tags.Length; i += 2)
            {
                ITag t = Tags.newTag(tags[i], tags[i + 1]);
                builder.add(t);
            }
            return(new BasicTagList(builder.result()));
        }
Exemple #4
0
 /**
  * Creates a new instance with a fixed set of tags.
  *
  * @param entries entries to include in this tag list
  */
 public BasicTagList(IEnumerable <ITag> entries)
 {
     SmallTagMap.Builder builder = SmallTagMap.builder();
     builder.addAll(entries);
     tagMap = builder.result();
 }