Package org.auraframework.impl.root

Examples of org.auraframework.impl.root.AttributeDefImpl$Builder


        //
        for (Map.Entry<DefDescriptor<AttributeDef>, AttributeDef> foo : def.getAttributeDefs().entrySet()) {
            AttributeDef attr = foo.getValue();
            DefDescriptor<?> typeDesc;
            if (attr instanceof AttributeDefImpl) {
                AttributeDefImpl attri = (AttributeDefImpl) attr;
                typeDesc = attri.getTypeDesc();
            } else {
                // bad.
                typeDesc = attr.getTypeDef().getDescriptor();
            }
            if (componentArrType.equals(typeDesc)) {
View Full Code Here


    @Override
    protected void handleChildTag() throws XMLStreamException, QuickFixException {
        String tag = getTagName();
        if (AttributeDefHandler.TAG.equalsIgnoreCase(tag)) {
            AttributeDefImpl attributeDef = new AttributeDefHandler<InterfaceDef>(this, xmlReader, source).getElement();
            builder.addAttributeDef(DefDescriptorImpl.getInstance(attributeDef.getName(), AttributeDef.class),
                    attributeDef);
        } else if (RegisterEventHandler.TAG.equalsIgnoreCase(tag)) {
            RegisterEventDefImpl regDef = new RegisterEventHandler<InterfaceDef>(this, xmlReader, source).getElement();
            builder.events.put(regDef.getAttributeName(), regDef);
        } else {
View Full Code Here

    @Override
    protected void handleChildTag() throws XMLStreamException, QuickFixException {
        String tag = getTagName();
        if (AttributeDefHandler.TAG.equalsIgnoreCase(tag)) {
            AttributeDefImpl attributeDef = new AttributeDefHandler<EventDef>(this, xmlReader, source).getElement();
            builder.getAttributeDefs().put(DefDescriptorImpl.getInstance(attributeDef.getName(), AttributeDef.class),
                    attributeDef);
        } else {
            error("Found unexpected tag %s", tag);
        }
    }
View Full Code Here

    @Override
    protected void handleChildTag() throws XMLStreamException, QuickFixException {
        String tag = getTagName();
        if (AttributeDefHandler.TAG.equalsIgnoreCase(tag)) {
            AttributeDefImpl attributeDef = new AttributeDefHandler<T>(this,
                    xmlReader, source).getElement();
            DefDescriptor<AttributeDef> attributeDesc = attributeDef
                    .getDescriptor();
            if (builder.getAttributeDefs().containsKey(attributeDesc)) {
                error("Duplicate definitions for attribute %s on tag %s",
                        attributeDesc.getName(), tag);
            }
            builder.getAttributeDefs().put(attributeDef.getDescriptor(),
                    attributeDef);
        } else if (RegisterEventHandler.TAG.equalsIgnoreCase(tag)) {
            RegisterEventDefImpl regDef = new RegisterEventHandler<T>(this, xmlReader,
                    source).getElement();
            if (builder.events.containsKey(regDef.getAttributeName())) {
View Full Code Here

    public AttributeDefImpl makeAttributeDef(String name,
                    DefDescriptor<TypeDef> typeDefDescriptor,
                    AttributeDefRefImpl defaultValue, boolean required,
                    SerializeToType serializeTo, Location location,
                    Visibility visibility) {
        return new AttributeDefImpl(
                            DefDescriptorImpl.getInstance(
                                            name == null ? defaultAttributeName : name,
                                            AttributeDef.class), null,
                            typeDefDescriptor == null ? getTypeDef().getDescriptor()
                                            : typeDefDescriptor,
View Full Code Here

                    DefDescriptor<? extends RootDefinition> parentDescriptor,
                    DefDescriptor<TypeDef> typeDefDescriptor,
                    AttributeDefRefImpl defaultValue, boolean required,
                    SerializeToType serializeTo, Location location,
                    Visibility visibility) {
        return new AttributeDefImpl(DefDescriptorImpl.getInstance(name,
                            AttributeDef.class), parentDescriptor, typeDefDescriptor,
                            defaultValue, required, serializeTo, location, visibility);
    }
View Full Code Here

    public ThemeDef makeThemeDef(Map<String, String> variables) {
            ThemeDefImpl.Builder builder = new ThemeDefImpl.Builder();
            for (Entry<String, String> entry : variables.entrySet()) {
                    AttributeDefRefImpl value = makeAttributeDefRef(entry.getKey(),
                                    entry.getValue(), null);
                    AttributeDefImpl attr = makeAttributeDef(entry.getKey(),
                                    DefDescriptorImpl.getInstance("String", TypeDef.class),
                                    value, false, null, null, null);
                    builder.addAttributeDef(attr.getDescriptor(), attr);
            }

            return builder.build();
    }
View Full Code Here

    public void testEventDef() throws Exception {
        DefDescriptor<EventDef> desc = DefDescriptorImpl.getInstance("fake:event", EventDef.class);
        Map<DefDescriptor<AttributeDef>, AttributeDef> atts = new HashMap<>();
        DefDescriptor<TypeDef> type = DefDescriptorImpl.getInstance("String", TypeDef.class);
        DefDescriptor<TypeDef> type2 = DefDescriptorImpl.getInstance("Integer", TypeDef.class);
        atts.put(DefDescriptorImpl.getInstance("testString", AttributeDef.class), new AttributeDefImpl(
                DefDescriptorImpl.getInstance("testString", AttributeDef.class), null, type, null, true,
                AttributeDef.SerializeToType.BOTH, null, null));
        atts.put(DefDescriptorImpl.getInstance("testInt", AttributeDef.class),
                new AttributeDefImpl(DefDescriptorImpl.getInstance("testInt", AttributeDef.class), null, type2, null,
                        true, AttributeDef.SerializeToType.BOTH, null, null));
        EventDefImpl def = vendor.makeEventDef(desc, EventType.COMPONENT, atts, null, null);
        def.validateDefinition();
        assertEquals(EventType.COMPONENT, def.getEventType());
        Map<DefDescriptor<AttributeDef>, AttributeDef> map = def.getDeclaredAttributeDefs();
View Full Code Here

    public void testValidateDefinitionPrivateAttribute() throws Exception {
        // checks if error is thrown when an attribute is set as private
        Map<DefDescriptor<AttributeDef>, AttributeDef> att = new HashMap<>();
        att.put(DefDescriptorImpl.getInstance("testInt", AttributeDef.class),
                new AttributeDefImpl(DefDescriptorImpl.getInstance("testInt", AttributeDef.class), null, null, null,
                        false, null, null, Visibility.PRIVATE));
        EventDefImpl eve = vendor.makeEventDef(null, null, att, null, null);
        try {
            eve.validateDefinition();
            fail("Validate should have caught private attributes");
View Full Code Here

    public void testSerialize() throws Exception {
        DefDescriptor<EventDef> desc = DefDescriptorImpl.getInstance("fake:event", EventDef.class);
        Map<DefDescriptor<AttributeDef>, AttributeDef> atts = new HashMap<>();
        DefDescriptor<TypeDef> type = DefDescriptorImpl.getInstance("String", TypeDef.class);
        DefDescriptor<TypeDef> type2 = DefDescriptorImpl.getInstance("Integer", TypeDef.class);
        atts.put(DefDescriptorImpl.getInstance("testString", AttributeDef.class), new AttributeDefImpl(
                DefDescriptorImpl.getInstance("testString", AttributeDef.class), null, type, null, true,
                AttributeDef.SerializeToType.BOTH, null, null));
        atts.put(DefDescriptorImpl.getInstance("testInt", AttributeDef.class),
                new AttributeDefImpl(DefDescriptorImpl.getInstance("testInt", AttributeDef.class), null, type2, null,
                        true, AttributeDef.SerializeToType.BOTH, null, null));
        EventDefImpl def = vendor.makeEventDefWithNulls(desc, EventType.COMPONENT, atts, null, null);
        serializeAndGoldFile(def);
    }
View Full Code Here

TOP

Related Classes of org.auraframework.impl.root.AttributeDefImpl$Builder

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.