Package org.joda.beans

Examples of org.joda.beans.Bean


        // storing target data
        ComputationTarget computationTarget = _computationTargetResolver.resolve(targetSpec, VersionCorrection.LATEST);
        Object targetValue = computationTarget.getValue();
        if (targetValue instanceof Bean) {
          Bean bean = (Bean) targetValue;
          for (String propertyName : bean.propertyNames()) {
            Property<Object> property = bean.property(propertyName);
            final long targetPropertyId = nextId(RSK_SEQUENCE_NAME);
            targetProperties.add(getTargetPropertyArgs(targetPropertyId, computationTargetId, propertyName, property.get() == null ? "NULL" : property.get().toString()));
          }
        }
      }
View Full Code Here


   * @return the item, not null
   */
  public static <T> ConfigItem<T> of(final T object) {
    final ConfigItem<T> item = new ConfigItem<T>(object);
    if (object instanceof Bean) {
      final Bean bean = (Bean) object;
      if (bean.metaBean().metaPropertyExists("name")) {
        item.setName(ObjectUtils.toString(bean.property("name").get(), null));
      }
    } else if (object != null) {
      try {
        item.setName((String) object.getClass().getMethod("getName").invoke(object));
      } catch (final Exception ex) {
View Full Code Here

   * @param remainingConfig  the config data, not null
   * @throws Exception allowing throwing of a checked exception
   */
  protected void setFactoryProperties(ComponentFactory factory, LinkedHashMap<String, String> remainingConfig) throws Exception {
    if (factory instanceof Bean) {
      Bean bean = (Bean) factory;
      for (MetaProperty<?> mp : bean.metaBean().metaPropertyIterable()) {
        String value = remainingConfig.remove(mp.name());
        setProperty(bean, mp, value);
      }
    }
  }
View Full Code Here

    };
    UniqueId uid1 = UniqueId.of("uid", "123");
    UniqueId uid2 = UniqueId.of("uid", "321");
    ExternalIdBundle eid1 = ExternalIdBundle.of(ExternalId.of("eid1", "321"));
    ExternalIdBundle eid2 = ExternalIdBundle.of(ExternalId.of("eid2", "abc"));
    Bean bean1 = createBean(uid1, eid1, "name1");
    Bean bean2 = createBean(uid2, eid2, "name1");
    MetaProperty<Object> uniqueIdMeta = bean1.property(UNIQUE_ID).metaProperty();
    MetaProperty<Object> externalIdMeta = bean1.property(EXTERNAL_ID_BUNDLE).metaProperty();
    Map<MetaProperty<?>, Comparator<Object>> comparators =
        ImmutableMap.<MetaProperty<?>, Comparator<Object>>of(
            uniqueIdMeta, alwaysEqualComparator,
View Full Code Here

    Object convertedValue = _converters.convert(value, property, type);
    if (convertedValue != Converters.CONVERSION_FAILED) {
      return convertedValue;
    }
    if (Bean.class.isAssignableFrom(value.getClass())) {
      Bean bean = (Bean) value;
      BuildingBeanVisitor<JSONObject> visitor = new BuildingBeanVisitor<>(bean, new JsonDataSink(_converters));
      return traverser.traverse(bean.metaBean(), visitor);
    } else {
      throw new IllegalArgumentException("Unable to convert " + value.getClass().getName());
    }
  }
View Full Code Here

   * @return        a clone of the supplied search request, with its paging request replaced
   */

  public static Bean withPagingRequest(final Bean requestBean, final PagingRequest pagingRequest) {
    if (requestBean.propertyNames().contains("pagingRequest")) {
      final Bean newRequest = JodaBeanUtils.clone(requestBean);
      if (pagingRequest != null) {
        newRequest.property("pagingRequest").set(
            PagingRequest.ofIndex(pagingRequest.getFirstItem(), pagingRequest.getPagingSize()));
      } else {
        newRequest.property("pagingRequest").set(null);
      }
      return newRequest;
    } else {
      throw new OpenGammaRuntimeException(
          "Could not invoke setPagingRequest() on request object of type " + requestBean.getClass());
View Full Code Here

TOP

Related Classes of org.joda.beans.Bean

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.