Package org.jboss.metadata.javaee.spec

Examples of org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData


/* 279 */     return ref;
/*     */   }
/*     */
/*     */   protected EnvironmentEntryMetaData createEntry(Resource annotation, E element)
/*     */   {
/* 284 */     EnvironmentEntryMetaData entry = new EnvironmentEntryMetaData();
/* 285 */     String name = annotation.name();
/* 286 */     if (name.length() == 0)
/* 287 */       name = getName(element);
/* 288 */     entry.setEnvEntryName(name);
/* 289 */     Descriptions descriptions = ProcessorUtils.getDescription(annotation.description());
/* 290 */     if (descriptions != null)
/* 291 */       entry.setDescriptions(descriptions);
/* 292 */     if (annotation.type() != Object.class)
/* 293 */       entry.setType(annotation.type().getName());
/*     */     else
/* 295 */       entry.setType(getType(element));
/* 296 */     if (annotation.mappedName().length() > 0)
/* 297 */       entry.setValue(annotation.mappedName());
/* 298 */     String injectionName = getInjectionName(element);
/* 299 */     Set injectionTargets = ProcessorUtils.getInjectionTargets(injectionName, element);
/* 300 */     if (injectionTargets != null) {
/* 301 */       entry.setInjectionTargets(injectionTargets);
/*     */     }
/* 303 */     return entry;
/*     */   }
View Full Code Here


* @author Remy Maucherat
*/
public class EnvironmentEntryMetaDataParser extends MetaDataElementParser {

    public static EnvironmentEntryMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        EnvironmentEntryMetaData environmentEntry = new EnvironmentEntryMetaData();

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    environmentEntry.setId(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        DescriptionsImpl descriptions = new DescriptionsImpl();
        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            if (DescriptionsMetaDataParser.parse(reader, descriptions)) {
                if (environmentEntry.getDescriptions() == null) {
                    environmentEntry.setDescriptions(descriptions);
                }
                continue;
            }
            if (ResourceInjectionMetaDataParser.parse(reader, environmentEntry)) {
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case ENV_ENTRY_NAME:
                    environmentEntry.setEnvEntryName(reader.getElementText());
                    break;
                case ENV_ENTRY_TYPE:
                    environmentEntry.setType(reader.getElementText());
                    break;
                case ENV_ENTRY_VALUE:
                    environmentEntry.setValue(reader.getElementText());
                    break;
                default: throw unexpectedElement(reader);
            }
        }

View Full Code Here

TOP

Related Classes of org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.