Package com.vercer.engine.persist

Examples of com.vercer.engine.persist.Path


    Set<Property> merged = new MergeSet<Property>(map.size());
    for (Object key: keys)
    {
      Object value = map.get(key);
      String keyString = converter.convert(key, String.class);
      Path childPath = Path.builder(path).field(keyString).build();
      Set<Property> properties = chained.typesafeToProperties(value, childPath, indexed);
     
      if (properties == null)
      {
        // we could not handle a value so pass the whole map down the chain
View Full Code Here


    for (Field field : fields)
    {
      if (stored(field))
      {
        String name = fieldToPartName(field);
        Path fieldPath = new Path.Builder(path).field(name).build();
       
        // handle missing class fields by ignoring the properties
        while (ppss.hasNext() && (pps == null || pps.getPrefix().compareTo(fieldPath) < 0))
        {
          pps = ppss.next();
        }
       
        // if there are no properties for the field we must still
        // run a translator because some translators do not require
        // any fields to set a field value e.g. KeyTranslator
        Set<Property> childProperties;
        if (pps == null || !fieldPath.equals(pps.getPrefix()))
        {
          // there were no properties for this field
          childProperties = Collections.emptySet();
        }
        else
View Full Code Here

            continue;
          }

          value = converters.convert(value, type);

          Path childPath = new Path.Builder(path).field(fieldToPartName(field)).build();

          PropertyTranslator translator = encoder(field, value);
          Set<Property> properties = translator.typesafeToProperties(value, childPath, indexed(field));
          if (properties == null)
          {
View Full Code Here

      complete = true;
      Set<Property> result = new HashSet<Property>(properties.size());
      for (Property property : properties)
      {
        List<?> values;
        Path itemPath = property.getPath();
        Object list = property.getValue();
       
        // every property should be of the same type but just repeat check
        if (list instanceof List<?>)
        {
View Full Code Here

          }

          for (Property property : properties)
          {
            Object value = property.getValue();
            Path itemPath = property.getPath();

            List<Object> values = lists.get(itemPath);
            if (values == null)
            {
              values = new ArrayList<Object>(4);

              lists.put(itemPath, values);
            }

            // need to pad the list with nulls if any values are missing
            while (values.size() < count)
            {
              values.add(null);
            }
            values.add(value);
          }
        }
        else
        {
          Collection<List<Object>> values = lists.values();
          for (List<Object> value : values)
          {
            value.add(null);
          }
        }
        count++;
      }

      // optimise for case of single properties
      if (lists.size() == 1)
      {
        Path childPath = lists.keySet().iterator().next();
        List<?> values = lists.get(childPath);
        return new SinglePropertySet(childPath, values, indexed);
      }
      else
      {
View Full Code Here

  }

  public Object propertiesToTypesafe(Set<Property> properties, final Path prefix, Type type)
  {
    String kindName = null;
    Path kindNamePath = new Path.Builder(prefix).meta(CLASS_NAME).build();
    for (Property property : properties)
    {
      if (property.getPath().equals(kindNamePath))
      {
        kindName = (String) property.getValue();
View Full Code Here

  public Set<Property> typesafeToProperties(Object object, Path prefix, boolean indexed)
  {
    Set<Property> properties = chained.typesafeToProperties(object, prefix, indexed);

    String className = object.getClass().getName();
    Path classNamePath = new Path.Builder(prefix).meta(CLASS_NAME).build();
    Property property = new SimpleProperty(classNamePath, className, true);

    return new PrependSet<Property>(property, properties);
  }
View Full Code Here

      }

      public Property next()
      {
        Entry<String, Object> next = iterator.next();
        return new SimpleProperty(new Path(next.getKey()), next.getValue(), indexed);
      }

      public void remove()
      {
        iterator.remove();
View Full Code Here

  {
    return Iterators.filter(properties.iterator(), new Predicate<Property>()
    {
      public boolean apply(Property source)
      {
        Path path = source.getPath();
        return path.equals(prefix) || path.hasPrefix(prefix);
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.vercer.engine.persist.Path

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.