Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.CollectionValueSupport


         // recalculate element info, since usually more deterministic
         TypeInfo typeInfo = configuration.getTypeInfo(ce.getClass());
         MetaType metaType = metaTypeFactory.resolve(typeInfo);
         elements[i++] = internalCreate(ce, typeInfo, metaType);            
      }
      CollectionValue result = new CollectionValueSupport(type, elements);
      mapping.put(value, result);
      return result;
   }
View Full Code Here


    public void populateMetaValueFromProperty(PropertyList property, MetaValue metaValue, PropertyDefinitionList propertyDefinition)
    {
        PropertyDefinition listMemberPropDef = propertyDefinition.getMemberDefinition();
        List<Property> listMemberProps = property.getList();
        CollectionValueSupport collectionValue = (CollectionValueSupport)metaValue;
        MetaType listMemberMetaType = collectionValue.getMetaType().getElementType();
        MetaValue[] listMemberValues = new MetaValue[listMemberProps.size()];
        PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMemberMetaType);
        int memberIndex = 0;
        for (Property listMemberProp : listMemberProps)
        {
            MetaValue listMemberValue = propertyAdapter.convertToMetaValue(listMemberProp, listMemberPropDef, listMemberMetaType);
            listMemberValues[memberIndex++] = listMemberValue;
        }
        // Replace the existing elements with the new ones.
        collectionValue.setElements(listMemberValues);
    }
View Full Code Here

    {
        LOG.debug("GetMetaValue for property: " + propertyList.getName() + " values: " + propertyList.getList().toString());
        CollectionMetaType collectionMetaType = (CollectionMetaType)metaType;
        MetaType memberMetaType = collectionMetaType.getElementType();
        CollectionMetaType collectionType = new CollectionMetaType(propertyListDefinition.getName(), memberMetaType);
        CollectionValue collectionValue = new CollectionValueSupport(collectionType);
        populateMetaValueFromProperty(propertyList, collectionValue, propertyListDefinition);
        return collectionValue;
    }
View Full Code Here

                Util.wrap(updatedConfiguration.getSimple(Util.ACTIVE_BINDING_SET_NAME_PROPERTY), String.class));

            PropertyList standardBindingsList = updatedConfiguration.getList(Util.STANDARD_BINDINGS_PROPERTY);

            MetaValue[] standarBindingsArray = new MetaValue[standardBindingsList.getList().size()];
            CollectionValueSupport standardBindingsValue = new CollectionValueSupport(
                (CollectionMetaType) bindingManagerComponent.getProperty(Util.STANDARD_BINDINGS_PROPERTY).getMetaType());
            standardBindingsValue.setElements(standarBindingsArray);

            ImmutableCompositeMetaType bindingMetaType = (ImmutableCompositeMetaType) standardBindingsValue
                .getMetaType().getElementType();

            int i = 0;
            for (Property p : standardBindingsList.getList()) {
                PropertyMap standardBindingMap = (PropertyMap) p;
View Full Code Here

                // Copy the original array into the new array.
                System.arraycopy(bindingSets.getElements(), 0, newBindingSets, 0, bindingSets.getSize());
                // Add the new one as the last element of the new array.
                newBindingSets[bindingSets.getSize()] = newBindingSet;

                CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
                newBindingSetsValue.setElements(newBindingSets);

                bindingSetsProperty.setValue(newBindingSetsValue);

                updateBindingManager(bindingManagerComponent);
View Full Code Here

            }
            updatedOverrideBindings.add(newBinding);
        }

        //recreate the collection of override bindings
        CollectionValueSupport newOverrideBindings = new CollectionValueSupport(overrideBindingsMetaType);
        newOverrideBindings.setElements(updatedOverrideBindings.toArray(new MetaValue[updatedOverrideBindings.size()]));
        currentBindingSet.put(OVERRIDE_BINDINGS_PROPERTY, newOverrideBindings);

        return currentBindingSet;
    }
View Full Code Here

            //create new set of binding sets
            CollectionValue bindingSets = (CollectionValue) bindingSetsProperty.getValue();
            List<MetaValue> newBindingSets = Util.replaceWithNew(bindingSets, thisBindingSetName, currentBindingSet);

            CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
            newBindingSetsValue.setElements(newBindingSets.toArray(new MetaValue[newBindingSets.size()]));

            bindingSetsProperty.setValue(newBindingSetsValue);

            context.getParentResourceComponent().updateBindingManager(bindingManager);
View Full Code Here

        //create new set of binding sets
        CollectionValue bindingSets = (CollectionValue) bindingSetsProperty.getValue();
        List<MetaValue> newBindingSets = Util.replaceWithNew(bindingSets, thisBindingSetName, null);

        CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
        newBindingSetsValue.setElements(newBindingSets.toArray(new MetaValue[newBindingSets.size()]));

        bindingSetsProperty.setValue(newBindingSetsValue);

        context.getParentResourceComponent().updateBindingManager(bindingManagerComponent);
    }
View Full Code Here

               log.warn("Skipping binding: "+ b, e);
            }
           
         }
         MetaValue[] elements = tmp.toArray(new MetaValue[tmp.size()]);
         CollectionValueSupport bindingSet = new CollectionValueSupport(MAP_VALUE_TYPE, elements);
        
         map.put(mapEntry.getKey(), bindingSet);
      }
     
      return new MapCompositeValueSupport(map, MAP_VALUE_TYPE);
View Full Code Here

            log.warn("Skipping binding: "+ b, e);
         }
        
      }
      MetaValue[] elements = tmp.toArray(new MetaValue[tmp.size()]);
      CollectionValueSupport bindings = new CollectionValueSupport(TYPE, elements);
      return bindings;
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.CollectionValueSupport

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.