Java 8 Attributes - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Attributes class.

This code example shows how to use the following methods:getLength, getLocalName, getQName, getURI
            @Override public void startElement(String uri, String localName,
                    String qName, Attributes attributes) {
                assertEquals("", uri);
                assertEquals("", localName);
                assertEquals("a:foo", qName);
                assertEquals(1, attributes.getLength());
                assertEquals("", attributes.getURI(0));
                assertOneOf("a:bar", "", attributes.getLocalName(0));
                assertEquals("a:bar", attributes.getQName(0));
            } 
        }); 
    } 
 
    /** 
     * Test that the external-general-entities feature can be disabled. 
     * http://code.google.com/p/android/issues/detail?id=9493 
     */ 
    public void testDisableExternalGeneralEntities() throws Exception { 
        String xml = "<!DOCTYPE foo ["
                + "  <!ENTITY bar SYSTEM \"/no-such-document.xml\">" 
8
CodeRank
This code example shows how to use the following methods:getValue
                        final Attributes attrs,
                        final ExtensibleXmlParser parser) throws SAXException {
        parser.startElementBuilder( localName,
                                    attrs );
         
        final String id = attrs.getValue( "id" );
        final String name = attrs.getValue( "name" );
        final String version = attrs.getValue( "version" );
        final String type = attrs.getValue( "type" );
        final String packageName = attrs.getValue( "package-name" );
        final String routerLayout = attrs.getValue( "routerLayout" );
         
        RuleFlowProcess process = new RuleFlowProcess();
        process.setId( id );
        process.setName( name );
        process.setVersion( version );
        process.setType( type );
        process.setPackageName( packageName );
        if (routerLayout != null) {
            process.setMetaData("routerLayout", new Integer(routerLayout));
7
CodeRank
This code example shows how to use the following methods:getValue
    return ex;
  } 
 
  /** Create RemoteException from attributes */ 
  public static RemoteException valueOf(Attributes attrs) {
    return new RemoteException(attrs.getValue("class"),
        attrs.getValue("message")); 
  } 
 
  @Override 
  public String toString() {
    return getClass().getName() + "(" + className + "): " + getMessage();
  } 
} 
7
CodeRank
This code example shows how to use the following methods:getValue
     *  
     * @param attrs the attributes from which version properties will be drawn 
     */ 
 
    VeecheckVersion(Attributes attrs) {
        packageName = emptyToNull(attrs.getValue("packageName"));
        versionCode = emptyToNull(attrs.getValue("versionCode"));
        versionName = emptyToNull(attrs.getValue("versionName"));
        buildBrand = emptyToNull(attrs.getValue("buildBrand"));
        buildId = emptyToNull(attrs.getValue("buildId"));
        buildModel = emptyToNull(attrs.getValue("buildModel"));
    } 
 
 
    /** 
     * Replaces tokens of the form <tt>${name}</tt> with version properties in a supplied URL. 
     *  
     * @param url the URL into which properties should be substituted 
     * @return the resulting URL, unchanged if no tokens were present 
     */ 
7
CodeRank
This code example shows how to use the following methods:getValue
	} 
 
	public Object start(final String uri, final String localName,
			final Attributes attrs, final ExtensibleXmlParser parser)
			throws SAXException {
		parser.startElementBuilder(localName, attrs);
		WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
 
		final String name = attrs.getValue("name");
		final String type = attrs.getValue("importType");
		final String location = attrs.getValue("location");
		final String namespace = attrs.getValue("namespace");
		emptyAttributeCheck(localName, "name", name, parser);
 
		if (type != null && location != null && namespace != null) {
    		Map<String, String> typedImports = (Map<String, String>) process.getMetaData(type);
    		if (typedImports == null) {
    		    typedImports = new HashMap<String, String>();
    		    process.setMetaData(type, typedImports);
    		} 
7
CodeRank
This code example shows how to use the following methods:getValue
   * @param attrs the attributes. 
   * @throws org.xml.sax.SAXException if there is a parsing error. 
   */ 
  protected void startParsing(final Attributes attrs) throws SAXException
  { 
    final String name = attrs.getValue(getUri(), "name");// NON-NLS
    parameter = new Parameter(name);
    parameter.setMandatory("true".equals(attrs.getValue(getUri(), "is-mandatory")));// NON-NLS
    parameter.setStrict("true".equals(attrs.getValue(getUri(), "is-strict")));// NON-NLS
    parameter.setMultiSelect("true".equals(attrs.getValue(getUri(), "is-multi-select")));// NON-NLS
    parameter.setType(attrs.getValue(getUri(), "type"));// NON-NLS
    parameter.setTimezoneHint(attrs.getValue(getUri(), "timezone-hint"));// NON-NLS
  } 
 
  /** 
   * Returns the handler for a child element. 
   * 
   * @param uri     the URI of the namespace of the current element. 
   * @param tagName the tag name. 
   * @param atts    the attributes. 
7
CodeRank
This code example shows how to use the following methods:getValue
   * @param attrs the attributes. 
   * @throws SAXException if there is a parsing error. 
   */ 
  protected void startParsing(final Attributes attrs) throws SAXException
  { 
    userName = attrs.getValue(getUri(), "userName");
    password = attrs.getValue(getUri(), "password");
    driverClass = attrs.getValue(getUri(), "driverClass");
    sqlQuery = attrs.getValue(getUri(), "sqlQuery");
    connectionString = attrs.getValue(getUri(), "connectionString");
  } 
 
  /** 
   * Returns the handler for a child element. 
   * 
   * @param uri     the URI of the namespace of the current element. 
   * @param tagName the tag name. 
   * @param atts    the attributes. 
   * @return the handler or null, if the tagname is invalid. 
   * @throws SAXException if there is a parsing error. 
7
CodeRank
This code example shows how to use the following methods:getValue
   * @param attrs the attributes. 
   * @throws SAXException if there is a parsing error. 
   */ 
  protected void startParsing(final Attributes attrs) throws SAXException
  { 
    color = ColorConverter.getObject(attrs.getValue(getUri(), "color"));
    final float width = ParserUtil.parseFloat(attrs.getValue(getUri(), "width"), "Failed to parse numeric value", getLocator());
    final float miterLimit = ParserUtil.parseFloat(attrs.getValue(getUri(), "miterlimit"), "Failed to parse numeric value", getLocator());
    final float dashPhase = ParserUtil.parseFloat(attrs.getValue(getUri(), "dashPhase"), "Failed to parse numeric value", getLocator());
    final int cap = ParserUtil.parseInt(attrs.getValue(getUri(), "cap"), "Failed to parse numeric value", getLocator());
    final int join = ParserUtil.parseInt(attrs.getValue(getUri(), "join"), "Failed to parse numeric value", getLocator());
    final String dashType = attrs.getValue(getUri(), "dash");
 
    float[] dash;
    if ("DOTTED".equals(dashType))
    { 
      dash = getDotted(width);
    } 
    else if ("DASHED".equals(dashType))
    { 
7
CodeRank
This code example shows how to use the following methods:getValue
    		String articleCount = atts.getValue("total_articles");
    		if(!TextUtils.isEmpty(articleCount)) {
    			mArticleCount = Integer.parseInt(articleCount);
    		}   		 
    	} else if (name.equals("article")) {
            mCurrentDrink = new Drink(Integer.parseInt(atts.getValue("id").trim()));
        } else if (name.equals("supplier") && !TextUtils.isEmpty(atts.getValue("url").trim())) {
            mCurrentDrink.setSupplierUrl(atts.getValue("url").trim());
        } else if (name.equals("volume")) {
            mCurrentVolume = new Volume();
            String articleId = atts.getValue("sb_article_id").trim();
            if (!TextUtils.isEmpty(articleId)) {
                mCurrentVolume.setArticleId(Integer.parseInt(articleId));
            } 
            mCurrentVolume.setPriceSek(atts.getValue("price").trim());
            mCurrentVolume.setRetired(Integer.parseInt(atts.getValue("retired").trim()));
        } else if (name.equals("tag")) {
        	mCurrentTag = new Tag();
        	mCurrentTag.setId(Integer.parseInt(atts.getValue("id")));
        	mCurrentTag.setType(atts.getValue("type"));

7
CodeRank
This code example shows how to use the following methods:getValue
   * @param attrs the attributes. 
   * @throws SAXException if there is a parsing error. 
   */ 
  protected void startParsing(final Attributes attrs) throws SAXException
  { 
    name = attrs.getValue(getUri(), "name"); // NON-NLS
    if (name == null)
    { 
      throw new ParseException("Attribute 'name' is undefined.", getLocator()); // NON-NLS 
    } 
    bundleName = attrs.getValue(getUri(), "bundle-name"); // NON-NLS
    if (bundleName == null)
    { 
      throw new ParseException("Attribute 'bundle-name' is undefined.", getLocator()); // NON-NLS 
    } 
    expert = "true".equals(attrs.getValue(getUri(), "expert")); // NON-NLS
    hidden = "true".equals(attrs.getValue(getUri(), "hidden")); // NON-NLS
    preferred = "true".equals(attrs.getValue(getUri(), "preferred")); // NON-NLS
    deprecated = "true".equals(attrs.getValue(getUri(), "deprecated")); // NON-NLS
 

7
CodeRank

Related Java 8 Attributes Questions & Answers:

See Code Examples for Java 8 Attributes Methods: