Package com.linkedin.data.template

Examples of com.linkedin.data.template.TyperefInfo


    {
      return dataSchema.getUnionMemberKey();
    }
    else if (dataSchema instanceof UnionDataSchema && HasTyperefInfo.class.isAssignableFrom(type))
    {
      final TyperefInfo unionRef = DataTemplateUtil.getTyperefInfo(type.asSubclass(DataTemplate.class));
      schemaToEncode = unionRef.getSchema();
    }
    else
    {
      schemaToEncode = dataSchema;
    }
View Full Code Here


    if (typerefInfoClass == null)
    {
      return null;
    }

    TyperefInfo typerefInfo = typerefInfoClass.newInstance();
    return typerefInfo.getSchema();

  }
View Full Code Here

public class TestTyperefUnion
{
  @Test
  public void testTyperefUnion()
  {
    TyperefInfo typerefInfo = DataTemplateUtil.getTyperefInfo(Union.class);
    assertNotNull(typerefInfo);
    TyperefDataSchema typerefDataSchema = typerefInfo.getSchema();

    Union union = new Union();
    assertTrue(union instanceof HasTyperefInfo);

    TyperefInfo typerefInfoFromInstance = union.typerefInfo();
    assertNotNull(typerefInfoFromInstance);
    TyperefDataSchema typerefDataSchemaFromInstance = typerefInfo.getSchema();

    assertSame(typerefDataSchemaFromInstance, typerefDataSchema);
    assertSame(typerefInfoFromInstance, typerefInfo);
View Full Code Here

  }

  @Test
  public void testNonTyperefUnion()
  {
    TyperefInfo typerefInfo = DataTemplateUtil.getTyperefInfo(TestRecordAndUnionTemplate.Foo.Union.class);
    assertNull(typerefInfo);

    TestRecordAndUnionTemplate.Foo.Union union = new TestRecordAndUnionTemplate.Foo.Union();
    assertFalse(union instanceof HasTyperefInfo);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.data.template.TyperefInfo

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.