Codota Logo
Tag
Code IndexAdd Codota to your IDE (free)

How to use
Tag
in
aQute.lib.tag

Best Java code snippets using aQute.lib.tag.Tag (Showing top 20 results out of 315)

  • Common ways to obtain Tag
private void myMethod () {
Tag t =
  • Codota Iconnew Tag("<changeme>")
  • Codota IconQute.bnd.make.metatype.MetaTypeReader metaTypeReader;String str;String value;metaTypeReader.ocd.addAttribute(str, value)
  • Codota IconQute.bnd.make.metatype.MetaTypeReader metaTypeReader;String str;String value;metaTypeReader.designate.addAttribute(str, value)
  • Smart code suggestions by Codota
}
origin: biz.aQute.bnd/biz.aQute.bnd

public Tag toTag() {
  Tag top = new Tag("metadata");
  if (modelVersion != null)
    top.addAttribute("modelVersion", modelVersion);
  new Tag(top, "groupId").addContent(group);
  new Tag(top, "artifactId").addContent(artifact);
  return top;
}
origin: biz.aQute/bndlib

public String findRecursiveAttribute(String name) {
  String value = getAttribute(name);
  if (value != null)
    return value;
  if (parent != null)
    return parent.findRecursiveAttribute(name);
  return null;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * convenient method to get the contents in a StringBuilder.
 */
public void getContentsAsString(StringBuilder sb) {
  for (Object o : content) {
    if (o instanceof Tag)
      ((Tag) o).getContentsAsString(sb);
    else
      sb.append(o);
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

Tag getTag() {
  Tag option = new Tag("Option").addAttribute("label", label)
    .addAttribute("value", value);
  return option;
}
origin: biz.aQute/bnd

spaces(pw, indent);
pw.print('<');
pw.print(name);
  String value = escape(attributes.get(key));
  pw.print(' ');
  pw.print(key);
  for (Object c : content) {
    if (c instanceof String) {
      formatted(pw, indent + 2, 60, escape((String) c));
    } else if (c instanceof Tag) {
      Tag tag = (Tag) c;
      tag.print(indent + 2, pw);
  spaces(pw, indent);
  pw.print("</");
  pw.print(name);
origin: biz.aQute.bnd/biz.aQute.bndlib

public boolean match(String search, Tag child, Tag mapping) {
  String target = child.getName();
  String sn = null;
  String tn = null;
  if (search.equals("*"))
    return true;
  int s = search.indexOf(':');
  if (s > 0) {
    sn = search.substring(0, s);
    search = search.substring(s + 1);
  }
  int t = target.indexOf(':');
  if (t > 0) {
    tn = target.substring(0, t);
    target = target.substring(t + 1);
  }
  if (!search.equals(target)) // different tag names
    return false;
  if (mapping == null) {
    return tn == sn || (sn != null && sn.equals(tn));
  }
  String suri = sn == null ? mapping.getAttribute("xmlns") : mapping.getAttribute("xmlns:" + sn);
  String turi = tn == null ? child.findRecursiveAttribute("xmlns") : child.findRecursiveAttribute("xmlns:" + tn);
  return ((turi == null) && (suri == null)) || ((turi != null) && turi.equals(suri));
}
origin: biz.aQute.bnd/biz.aQute.bndlib

spaces(pw, indent);
pw.print('<');
pw.print(name);
  String value = escape(attributes.get(key));
  pw.print(' ');
  pw.print(key);
      tag.print(indent + 2, pw);
    } else {
      if (c == null)
        pw.print("]]>");
      } else
        pw.print(escape(s));
    spaces(pw, indent);
origin: biz.aQute.bnd/biz.aQute.bndlib

public String compact() {
  StringWriter sw = new StringWriter();
  print(Integer.MIN_VALUE, new PrintWriter(sw));
  return sw.toString();
}
origin: biz.aQute.bnd/biz.aQute.bnd

  @Override
  public Tag toTag() {
    Tag top = super.toTag();
    if (latest != null)
      new Tag(top, "latest").addContent(latest.toString());
    if (release != null)
      new Tag(top, "release").addContent(release.toString());
    Tag versioning = new Tag(top, "versioning");
    Tag versionsTag = new Tag(versioning, "versions");
    for (MavenVersion mv : versions) {
      new Tag(versionsTag, "version").addContent(mv.toString());
    }
    new Tag(versioning, "lastUpdated", timestamp.format(new Date(lastUpdated)));
    return top;
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public Tag(Tag parent, String name, Object... contents) {
  this(name, contents);
  parent.addContent(this);
}
origin: biz.aQute/bndlib

/**
 * Return only the tags of the first level of descendants that match the
 * name.
 */
public List<Object> getContents(String tag) {
  List<Object> out = new ArrayList<Object>();
  for (Object o : out) {
    if (o instanceof Tag && ((Tag) o).getName().equals(tag))
      out.add(o);
  }
  return out;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public String getNameSpace() {
  return getNameSpace(name);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public String getNameSpace(String name) {
  int index = name.indexOf(':');
  if (index > 0) {
    String ns = name.substring(0, index);
    return findRecursiveAttribute("xmlns:" + ns);
  }
  return findRecursiveAttribute("xmlns");
}
origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Return the attribute value or a default if not defined.
 */
public String getAttribute(String key, String deflt) {
  String answer = getAttribute(key);
  return answer == null ? deflt : answer;
}
origin: biz.aQute/bndlib

/**
 * Construct a new Tag with a name and a set of attributes. The attributes
 * are given as ( name, value ) ...
 */
public Tag(String name, String[] attributes, Object... contents) {
  this(name, contents);
  for (int i = 0; i < attributes.length; i += 2)
    addAttribute(attributes[i], attributes[i + 1]);
}
origin: biz.aQute/bndlib

spaces(pw, indent);
pw.print('<');
pw.print(name);
  String value = escape(attributes.get(key));
  pw.print(' ');
  pw.print(key);
        pw.print("]]>");
      } else
        formatted(pw, indent + 2, 60, escape((String) c));
    } else if (c instanceof Tag) {
      Tag tag = (Tag) c;
      tag.print(indent + 2, pw);
  spaces(pw, indent);
  pw.print("</");
  pw.print(name);
origin: biz.aQute/bndlib

public boolean match(String search, Tag child, Tag mapping) {
  String target = child.getName();
  String sn = null;
  String tn = null;
  if (search.equals("*"))
    return true;
  int s = search.indexOf(':');
  if (s > 0) {
    sn = search.substring(0, s);
    search = search.substring(s + 1);
  }
  int t = target.indexOf(':');
  if (t > 0) {
    tn = target.substring(0, t);
    target = target.substring(t + 1);
  }
  if (!search.equals(target)) // different tag names
    return false;
  if (mapping == null) {
    return tn == sn || (sn != null && sn.equals(tn));
  }
  String suri = sn == null ? mapping.getAttribute("xmlns") : mapping.getAttribute("xmlns:" + sn);
  String turi = tn == null ? child.findRecursiveAttribute("xmlns") : child.findRecursiveAttribute("xmlns:" + tn);
  return ((turi == null) && (suri == null)) || ((turi != null) && turi.equals(suri));
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public XMLResourceGenerator referral(URI reference, int depth) {
  Tag referall = new Tag(repository, "referral");
  referall.addAttribute("url", reference);
  if (depth > 0)
    referall.addAttribute("depth", depth);
  return this;
}
origin: biz.aQute.bnd/biz.aQute.bnd

spaces(pw, indent);
pw.print('<');
pw.print(name);
  String value = escape(attributes.get(key));
  pw.print(' ');
  pw.print(key);
      tag.print(indent + 2, pw);
    } else {
      if (c == null)
        pw.print("]]>");
      } else
        pw.print(escape(s));
    spaces(pw, indent);
origin: biz.aQute/bndlib

/**
 * Return a string representation of this Tag and all its children
 * recursively.
 */
@Override
public String toString() {
  StringWriter sw = new StringWriter();
  print(0, new PrintWriter(sw));
  return sw.toString();
}
aQute.lib.tagTag

Javadoc

The Tag class represents a minimal XML tree. It consist of a named element with a hashtable of named attributes. Methods are provided to walk the tree and get its constituents. The content of a Tag is a list that contains String objects or other Tag objects.

Most used methods

  • <init>
    Construct a new Tag with a name and a set of attributes. The attributes are given as ( name, value )
  • addAttribute
  • addContent
    Add a new content string.
  • print
  • escape
    Escape a string, do entity conversion.
  • findRecursiveAttribute
  • getAttribute
    Return the attribute value or a default if not defined.
  • getContentsAsString
    convenient method to get the contents in a StringBuilder.
  • getName
    Return the name of the tag.
  • getNameSpace
  • match
  • select
  • match,
  • select,
  • spaces,
  • formatted,
  • computeArrayElementName,
  • convertDTO,
  • fromDTO,
  • getFields,
  • getPath,
  • invalid

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • String (java.lang)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • JFileChooser (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now