Parses an attribute for an annotation.
543236
private void scanAttributeForAnnotation(InputStream is)
    throws IOException
  {
    int nameIndex = readShort(is);

    // String name = _cp.getUtf8(nameIndex).getValue();
      
    int length = readInt(is);

    if (! isNameAnnotation(nameIndex)) {
      is.skip(length);
      return;
    }
      
    int count = readShort(is);
      
    for (int i = 0; i < count; i++) {
      int annTypeIndex = scanAnnotation(is);
      
      if (annTypeIndex > 0 && _cpLengths[annTypeIndex] > 2) {
        _matcher.addClassAnnotation(_charBuffer, 
                                    _cpData[annTypeIndex] + 1, 
                                    _cpLengths[annTypeIndex] - 2);
      }
    }
  }
131814
private boolean processAttributeAnnotation(Field field) {
        // Default to no syntax specified
        syntax = "";
        
        // Default to a String based attribute
        isBinary = false;
        
        // Default name of attribute to the name of the field
        name = new CaseIgnoreString(field.getName());
        
        // We have not yet found the @Attribute annotation
        boolean foundAnnotation=false;
        
        // Grab the @Attribute annotation
        Attribute attribute = field.getAnnotation(Attribute.class);

        List<String> attrList = new ArrayList<String>();
        // Did we find the annotation?
        if (attribute != null) {
            // Pull attribute name, syntax and whether attribute is binary
            // from the annotation 
            foundAnnotation=true;
            String localAttributeName = attribute.name();
            // Would be more efficient to use !isEmpty - but that then makes us Java 6 dependent
            if (localAttributeName != null && localAttributeName.length()>0) {
                name = new CaseIgnoreString(localAttributeName);
                attrList.add(localAttributeName);
            }
            syntax = attribute.syntax();
            isBinary = attribute.type() == Attribute.Type.BINARY;
            isReadOnly = attribute.readonly();
        }
        attributes = attrList.toArray(new String[attrList.size()]);
        
        isObjectClass=name.equals(OBJECT_CLASS_ATTRIBUTE_CI);
        
        return foundAnnotation;
    }
1226099
def parse_attributes(attributes=None, classname=None):
  
  if not attributes:
    attributes = {}
  attributes.setdefault('class', DEFAULT_CLASS_NAME)
  # If `classname` is specified, it overwrites `class` property in `attributes`.
  if classname:
    attributes['class'] = classname
  return attributes
417828
protected void parseDeclaredAttributes() {
        ItemRuleMap attributeItemRuleMap = getRequestRule().getAttributeItemRuleMap();
        if (attributeItemRuleMap != null && !attributeItemRuleMap.isEmpty()) {
            ItemEvaluator evaluator = new ItemExpression(this);
            for (ItemRule itemRule : attributeItemRuleMap.values()) {
                Object value = evaluator.evaluate(itemRule);
                getRequestAdapter().setAttribute(itemRule.getName(), value);
            }
        }
    }
852810
private void parseAttributes(AttributeSet attrs) {
        if (attrs != null) {
            TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.ExpandableMenuOverlay, 0, 0);
            try {
                // button metrics
                mainButtonSize = a.getFloat(R.styleable.ExpandableMenuOverlay_mainButtonSize, DEFAULT_MAIN_BUTTON_SIZE);
                otherButtonSize = a.getFloat(R.styleable.ExpandableMenuOverlay_otherButtonSize, DEFAULT_OTHER_BUTTON_SIZE);
                bottomPadding = a.getFloat(R.styleable.ExpandableMenuOverlay_bottomPad, DEFAULT_BOTTOM_PADDING);
                buttonDistanceY = a.getFloat(R.styleable.ExpandableMenuOverlay_distanceY, DEFAULT_BUTTON_DISTANCE_Y);
                buttonDistanceX = a.getFloat(R.styleable.ExpandableMenuOverlay_distanceX, DEFAULT_BUTTON_DISTANCE_X);

                // button resources
                mCloseBtn.setBackgroundResource(a.getResourceId(R.styleable.ExpandableMenuOverlay_closeButtonSrc, 0));
                mLeftBtn.setBackgroundResource(a.getResourceId(R.styleable.ExpandableMenuOverlay_leftButtonSrc, 0));
                mRightBtn.setBackgroundResource(a.getResourceId(R.styleable.ExpandableMenuOverlay_rightButtonSrc, 0));
                mMidBtn.setBackgroundResource(a.getResourceId(R.styleable.ExpandableMenuOverlay_midButtonSrc, 0));

                // button text
                mLeftText.setText(a.getResourceId(R.styleable.ExpandableMenuOverlay_leftButtonText, R.string.empty));
                mRightText.setText(a.getResourceId(R.styleable.ExpandableMenuOverlay_rightButtonText, R.string.empty));
                mMidText.setText(a.getResourceId(R.styleable.ExpandableMenuOverlay_midButtonText, R.string.empty));

            } finally {
                a.recycle();
            }
        }
    }
654581
private void parseAttDef(String elementName) throws Exception {
        String name;
        String type;
        String enumer = null;

        // Read the attribute name.
        name = readNmtoken(true);

        // Read the attribute type.
        requireWhitespace();
        type = readAttType();

        // Get the string of enumerated values if necessary.
        if (handler.stringInterning) {
            if (("ENUMERATION" == type) || ("NOTATION" == type)) {
                enumer = dataBufferToString();
            }
        } else {
            if ("ENUMERATION".equals(type) || "NOTATION".equals(type)) {
                enumer = dataBufferToString();
            }
        }

        // Read the default value.
        requireWhitespace();
        parseDefault(elementName, name, type, enumer);
    }
559225
def parse_attribute
      ns_id, name_id, val_str_id, flags, val = @io.read(4*5).unpack("V*")
      key = @strings[name_id]
      unless ns_id == 0xFFFFFFFF
        ns = @strings[ns_id] 
        prefix = ns.sub(/.*\//,'')
        unless @ns.include? ns
          @ns << ns
          @doc.root.add_namespace(prefix, ns)
        end
        key = "#{prefix}:#{key}"
      end
      value = convert_value(val_str_id, flags, val)
      return key, value
    end
1304864
private void parseAttribute(final Attributes atts) {
        final URI attrValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
        if (attrValue == null) {
            return;
        }

        final String attrScope = atts.getValue(ATTRIBUTE_NAME_SCOPE);
        if (isExternal(attrValue, attrScope)) {
            return;
        }

        String attrFormat = atts.getValue(ATTRIBUTE_NAME_FORMAT);
        if (attrFormat == null || ATTR_FORMAT_VALUE_DITA.equals(attrFormat)) {
            final File target = toFile(attrValue);
            topicHref = target.isAbsolute() ? attrValue : currentDir.resolve(attrValue);

            if (attrValue.getFragment() != null) {
                topicId = attrValue.getFragment();
            } else {
                if (attrFormat == null || attrFormat.equals(ATTR_FORMAT_VALUE_DITA) || attrFormat.equals(ATTR_FORMAT_VALUE_DITAMAP)) {
                    topicId = topicHref + QUESTION;
                }
            }
        } else {
            topicHref = null;
            topicId = null;
        }
    }
142239
public AttributeDataset parse(InputStream stream) throws IOException, ParseException {
        try (Reader r = new BufferedReader(new InputStreamReader(stream))) {
            StreamTokenizer tokenizer = new StreamTokenizer(r);
            initTokenizer(tokenizer);

            List<Attribute> attributes = new ArrayList<>();
            String relationName = readHeader(tokenizer, attributes);

            if (attributes.isEmpty()) {
                throw new IOException("no header information available");
            }
        
            Attribute response = null;
            Attribute[] attr = new Attribute[attributes.size()];
            attributes.toArray(attr);
        
            for (int i = 0; i < attributes.size(); i++) {
                if (responseIndex == i) {
                    response = attributes.remove(i);
                    break;
                }
            }
        
            AttributeDataset data = new AttributeDataset(relationName, attributes.toArray(new Attribute[attributes.size()]), response);
        
            while (true) {
                // Check if end of file reached.
                getFirstToken(tokenizer);
                if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
                    break;
                }

                // Parse instance
                if (tokenizer.ttype == '{') {
                    readSparseInstance(tokenizer, data, attr);
                } else {
                    readInstance(tokenizer, data, attr);
                }
            }
        
            for (Attribute attribute : attributes) {
                if (attribute instanceof NominalAttribute) {
                    NominalAttribute a = (NominalAttribute) attribute;
                    a.setOpen(false);
                }
            
                if (attribute instanceof StringAttribute) {
                    StringAttribute a = (StringAttribute) attribute;
                    a.setOpen(false);
                }
            }
        
            return data;
        }
    }
475563
def _parse_attribute(
            self,
            element,  # type: ET.Element
            attribute,  # type: Text
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        parsed_value = self._default
        attribute_value = element.get(attribute, None)

        if attribute_value is not None:
            parsed_value = self._parser_func(attribute_value, state)
        elif self.required:
            state.raise_error(
                MissingValue, 'Missing required attribute "{}" on element "{}"'.format(
                    self._attribute, element.tag
                )
            )

        return parsed_value
317528
public Attribute parseAttribute()
    throws IOException
  {
    int nameIndex = readShort();

    String name = _cp.getUtf8(nameIndex).getValue();

    if (name.equals("Code")) {
      CodeAttribute code = new CodeAttribute(name);
      code.read(this);
      return code;
    }
    else if (name.equals("Exceptions")) {
      ExceptionsAttribute code = new ExceptionsAttribute(name);
      code.read(this);
      return code;
    }
    else if (name.equals("Signature")) {
      SignatureAttribute attr = new SignatureAttribute();
      attr.read(this);
      return attr;
    }
    else if (name.equals("BootstrapMethods")) {
      BootstrapMethodAttribute attr = new BootstrapMethodAttribute();
      attr.read(this);
      return attr;
    }
    
    OpaqueAttribute attr = new OpaqueAttribute(name);
    
    int length = readInt();

    byte []bytes = new byte[length];
    
    read(bytes, 0, bytes.length);

    attr.setValue(bytes);

    return attr;
  }
725256
public static Object getAnnotationAttribute(final Annotation annotation, final String attributeName) {
        Object object = null;
        try {
            // Get the annotation method for the given name
            final Method attributeMethod = annotation.annotationType().getDeclaredMethod(attributeName);

            // Call the method to gets the value
            object = attributeMethod.invoke(annotation);

        } catch (NoSuchMethodException | SecurityException e) {
            LOGGER.log(NO_ANNOTATION_PROPERTY, e, attributeName);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            LOGGER.log(NO_ANNOTATION_PROPERTY_VALUE, e, attributeName);
        }
        return object;
    }
800660
private void parseAttribute(String name) throws Exception {
        String aname;
        String type;
        String value;
        int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;

        // Read the attribute name.
        aname = readNmtoken(true);
        type = getAttributeType(name, aname);

        // Parse '='
        parseEq();

        // Read the value, normalizing whitespace
        // unless it is CDATA.
        if (handler.stringInterning) {
            if ((type == "CDATA") || (type == null)) {
                value = readLiteral(flags);
            } else {
                value = readLiteral(flags | LIT_NORMALIZE);
            }
        } else {
            if ((type == null) || type.equals("CDATA")) {
                value = readLiteral(flags);
            } else {
                value = readLiteral(flags | LIT_NORMALIZE);
            }
        }

        // WFC: no duplicate attributes
        for (int i = 0; i < tagAttributePos; i++) {
            if (aname.equals(tagAttributes[i])) {
                fatal("duplicate attribute", aname, null);
            }
        }

        // Inform the handler about the
        // attribute.
        handler.attribute(aname, value, true);
        dataBufferPos = 0;

        // Note that the attribute has been
        // specified.
        if (tagAttributePos == tagAttributes.length) {
            String newAttrib[] = new String[tagAttributes.length * 2];
            System.arraycopy(tagAttributes, 0, newAttrib, 0, tagAttributePos);
            tagAttributes = newAttrib;
        }
        tagAttributes[tagAttributePos++] = aname;
    }
62540
public static String extractAsEnumerationValue(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute) {
		final Elements elementUtils=BindDataSourceSubProcessor.elementUtils;
		final One<String> result = new One<String>();

		extractAttributeValue(elementUtils, item, annotationClass.getName(), attribute, new OnAttributeFoundListener() {

			@Override
			public void onFound(String value) {
				if (value.indexOf(".") >= 0)
					result.value0 = value.substring(value.lastIndexOf(".") + 1);
			}
		});

		return result.value0;
	}
689472
@SuppressWarnings("unchecked")
    public <A extends Annotation> A getAnnotation(final Field field, final Class<A> annClass) throws AnnotationReadException {
        
        final Class<?> clazz = field.getDeclaringClass();
        
        if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
            final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
            
            if(classInfo.containsFieldInfo(field.getName())) {
                FieldInfo fieldInfo = classInfo.getFieldInfo(field.getName());
                if(fieldInfo != null && fieldInfo.containsAnnotationInfo(annClass.getName())){
                    AnnotationInfo annInfo = fieldInfo.getAnnotationInfo(annClass.getName());
                    try {
                        return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
                    } catch (ClassNotFoundException e) {
                        throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
                    }
                }
            }
        }
        return field.getAnnotation(annClass);
    }
447428
public AttributeDataset parse(Attribute[] attributes, File file) throws IOException, ParseException {
        String name = file.getPath();
        return parse(name, attributes, file);
    }
7335
private List<Pair<MethodSymbol, Attribute>> attributeAnnotationValues(JCAnnotation a,
            Type expected, Env<AttrContext> env)
    {
        // The annotation might have had its type attributed (but not
        // checked) by attr.attribAnnotationTypes during MemberEnter,
        // in which case we do not need to do it again.
        Type at = (a.annotationType.type != null ?
                a.annotationType.type : attr.attribType(a.annotationType, env));
        a.type = chk.checkType(a.annotationType.pos(), at, expected);

        boolean isError = a.type.isErroneous();
        if (!a.type.tsym.isAnnotationType() && !isError) {
            log.error(a.annotationType.pos(),
                    "not.annotation.type", a.type.toString());
            isError = true;
        }

        // List of name=value pairs (or implicit "value=" if size 1)
        List<JCExpression> args = a.args;

        boolean elidedValue = false;
        // special case: elided "value=" assumed
        if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
            args.head = make.at(args.head.pos).
                    Assign(make.Ident(names.value), args.head);
            elidedValue = true;
        }

        ListBuffer<Pair<MethodSymbol,Attribute>> buf = new ListBuffer<>();
        for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
            Pair<MethodSymbol, Attribute> p = attributeAnnotationNameValuePair(tl.head, a.type, isError, env, elidedValue);
            if (p != null && !p.fst.type.isErroneous())
                buf.append(p);
        }
        return buf.toList();
    }