Package com.linkedin.data

Examples of com.linkedin.data.DataMap


    {
      if (java.getClass() != DataMap.class)
      {
        throw new IllegalArgumentException(schema + " has \"java\" property that is not a DataMap");
      }
      DataMap map = (DataMap) java;
      Object custom = map.get(CLASS_PROPERTY);
      if (custom != null)
      {
        if (custom.getClass() != String.class)
        {
          throw new IllegalArgumentException(schema + " has \"java\" property with \"class\" that is not a string");
        }
        // a custom class specification has been found
        customClasses = new CustomClasses();
        customClasses.javaClass = getCodeModel().directClass((String) custom);
        if (allowCustomClass(schema) == false)
        {
          throw new IllegalArgumentException(schema + " cannot have custom class binding");
        }
      }
      // check for coercer class
      Object customClass = map.get(COERCER_CLASS_PROPERTY);
      if (customClass != null)
      {
        if (customClass.getClass() != String.class)
        {
          throw new IllegalArgumentException(schema + " has \"java\" property with \"coercerClass\" that is not a string");
View Full Code Here


  private void setDeprecatedAnnotationAndJavadoc(EnumDataSchema enumSchema, String symbol, JEnumConstant constant)
  {
    Object deprecatedSymbolsProp = enumSchema.getProperties().get(DEPRECATED_SYMBOLS_KEY);
    if (deprecatedSymbolsProp instanceof DataMap)
    {
      DataMap deprecatedSymbols = (DataMap)deprecatedSymbolsProp;

      Object deprecatedProp = deprecatedSymbols.get(symbol);
      setDeprecatedAnnotationAndJavadoc(deprecatedProp, constant, constant);
    }
  }
View Full Code Here

    for (Object modelObj : models)
    {
      NamedDataSchema dataSchema;
      if (modelObj instanceof DataMap)
      {
        DataMap model = (DataMap)modelObj;
        dataSchema = (NamedDataSchema) RestSpecCodec.textToSchema(_dataCodec.mapToString(model), _dataSchemaResolver);
      }
      else if (modelObj instanceof String)
      {
        String str = (String)modelObj;
View Full Code Here

    Assert.assertTrue(args[args.length - 1] instanceof PatchRequest);
    Map<String, Object> aMap = new HashMap<String, Object>();
    aMap.put("a", "someString");
    Map<String, Object> setMap = new HashMap<String, Object>();
    setMap.put("$set", new DataMap(aMap));
    Map<String, Object> data = new HashMap<String, Object>();
    data.put("patch", new DataMap(setMap));
    PatchRequest<MyComplexKey> patch = new PatchRequest<MyComplexKey>(new DataMap(data));
    Assert.assertEquals(args[args.length - 1], patch);

    EasyMock.verify(request, model, descriptor, context, routingResult);
  }
View Full Code Here

   * @param inputStream an input stream that represents a {@link DataMap} with two fields: "models", which
   * @throws IOException if the inputStream cannot be parsed as a {@link DataMap} or {@link String}.
   */
  public Snapshot(InputStream inputStream) throws IOException
  {
    DataMap data = _dataCodec.readMap(inputStream);
    _models = parseModels(data.getDataList(MODELS_KEY));
    _resourceSchema = parseSchema(data.getDataMap(SCHEMA_KEY));
  }
View Full Code Here

*/
public class RestSpec extends AbstractSnapshot
{
  public RestSpec(InputStream inputStream) throws IOException
  {
    DataMap data = _dataCodec.readMap(inputStream);
    _models = new HashMap<String, NamedDataSchema>();
    _resourceSchema = parseSchema(data);
  }
View Full Code Here

    if (filter == null)
    {
      return paths;
    }

    final DataMap filterMap = filter.getDataMap();
    if (filter.getDataMap().isEmpty())
    {
      return Collections.emptySet();
    }

    final DataMap pathSpecMap = createPathSpecMap(paths);

    @SuppressWarnings("unchecked")
    final DataMap filteredPathSpecs = (DataMap) new PathSpecFilter().filter(pathSpecMap, filterMap);

    return validate(filteredPathSpecs, paths);
  }
View Full Code Here

    return validate(filteredPathSpecs, paths);
  }

  private static DataMap createPathSpecMap(Set<PathSpec> paths)
  {
    final DataMap pathSpecMap = new DataMap();

    for (PathSpec p : paths)
    {
      final List<String> components = p.getPathComponents();
      DataMap currentMap = pathSpecMap;

      for (int i = 0; i < components.size(); ++i)
      {
        final String currentComponent = components.get(i);
        final Object currentValue = currentMap.get(currentComponent);

        if (i < components.size() - 1)
        {
          if (currentValue instanceof DataMap)
          {
            @SuppressWarnings("unchecked")
            final DataMap valueMap = (DataMap) currentValue;
            currentMap = valueMap;
          }
          else
          {
            final DataMap newMap = new DataMap();
            currentMap.put(currentComponent, newMap);
            currentMap = newMap;
          }
        }
        else if (currentValue == null)
View Full Code Here

    final Set<PathSpec> result = new HashSet<PathSpec>();

    for (PathSpec p : paths)
    {
      final List<String> components = p.getPathComponents();
      DataMap currentMap = filteredPathSpecs;
      boolean isPresent = true;

      for (int i = 0; i < components.size(); ++i)
      {
        final String currentComponent = components.get(i);
        final Object currentValue = currentMap.get(currentComponent);

        if (currentValue instanceof DataMap)
        {
          @SuppressWarnings("unchecked")
          final DataMap valueMap = (DataMap) currentValue;
          currentMap = valueMap;
        }
        else
        {
View Full Code Here

    public static final RecordDataSchema.Field FIELD_union = SCHEMA.getField("union");

    public Foo()
    {
      super(new DataMap(), SCHEMA);
    }
View Full Code Here

TOP

Related Classes of com.linkedin.data.DataMap

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.