当前位置: 首页>>代码示例>>Java>>正文


Java IsA类代码示例

本文整理汇总了Java中uk.gov.gchq.koryphe.impl.predicate.IsA的典型用法代码示例。如果您正苦于以下问题:Java IsA类的具体用法?Java IsA怎么用?Java IsA使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IsA类属于uk.gov.gchq.koryphe.impl.predicate包,在下文中一共展示了IsA类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldDeserialiseFromSimpleClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException, ClassNotFoundException {
    // Given
    final SimpleClassKeyDeserializer deserialiser = new SimpleClassKeyDeserializer();
    final DeserializationContext context = mock(DeserializationContext.class);
    final Class expectedClass = IsA.class;
    final String id = expectedClass.getSimpleName();
    given(context.findClass(expectedClass.getName())).willReturn(expectedClass);

    // When
    final Class<?> clazz = (Class<?>) deserialiser.deserializeKey(id, context);

    // Then
    assertEquals(expectedClass, clazz);
    verify(context).findClass(expectedClass.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:17,代码来源:SimpleClassKeyDeserializerTest.java

示例2: shouldDeserialiseFromSimpleClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException, ClassNotFoundException {
    // Given
    final SimpleClassDeserializer deserialiser = new SimpleClassDeserializer();
    final DeserializationContext context = mock(DeserializationContext.class);
    final Class expectedClass = IsA.class;
    final String id = expectedClass.getSimpleName();
    given(context.findClass(expectedClass.getName())).willReturn(expectedClass);

    // When
    final Class<?> clazz = deserialiser._deserialize(id, context);

    // Then
    assertEquals(expectedClass, clazz);
    verify(context).findClass(expectedClass.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:17,代码来源:SimpleClassDeserializerTest.java

示例3: shouldDeserialiseFromFullClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException, ClassNotFoundException {
    // Given
    final SimpleClassDeserializer deserialiser = new SimpleClassDeserializer();
    final DeserializationContext context = mock(DeserializationContext.class);
    final Class expectedClass = IsA.class;
    final String id = expectedClass.getName();
    given(context.findClass(expectedClass.getName())).willReturn(expectedClass);

    // When
    final Class<?> clazz = deserialiser._deserialize(id, context);

    // Then
    assertEquals(expectedClass, clazz);
    verify(context).findClass(expectedClass.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:17,代码来源:SimpleClassDeserializerTest.java

示例4: isAString

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
public void isAString() {
    // ---------------------------------------------------------
    final IsA function = new IsA(String.class);
    // ---------------------------------------------------------

    runExample(function,
            null,
            1, 2.5, "abc");
}
 
开发者ID:gchq,项目名称:gaffer-doc,代码行数:10,代码来源:IsAExample.java

示例5: isANumber

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
public void isANumber() {
    // ---------------------------------------------------------
    final IsA function = new IsA(Number.class);
    // ---------------------------------------------------------

    runExample(function,
            null,
            1, 2.5, "abc");
}
 
开发者ID:gchq,项目名称:gaffer-doc,代码行数:10,代码来源:IsAExample.java

示例6: shouldJsonSerialiseAndDeserialise

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldJsonSerialiseAndDeserialise() throws IOException {
    // Given
    final PredicateMap<String> mapFilter = new PredicateMap<>(DATE_KEY, new IsA(Map.class));

    // When
    final String json = JsonSerialiser.serialise(mapFilter);

    // Then
    JsonSerialiser.assertEquals(String.format("{\n" +
            "  \"class\" : \"uk.gov.gchq.koryphe.predicate.PredicateMap\",\n" +
            "  \"predicate\" : {\n" +
            "    \"class\" : \"uk.gov.gchq.koryphe.impl.predicate.IsA\",\n" +
            "    \"type\" : \"java.util.Map\"\n" +
            "  },\n" +
            "  \"key\" : {\n" +
            "    \"java.util.Date\" : " + DATE_KEY.getTime() + "%n" +
            "  }\n" +
            "}"), json);

    // When 2
    final PredicateMap deserialisedFilter = JsonSerialiser.deserialise(json, PredicateMap.class);

    // Then 2
    assertNotNull(deserialisedFilter);
    assertEquals(DATE_KEY, deserialisedFilter.getKey());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:28,代码来源:PredicateMapTest.java

示例7: shouldDeserialiseFromFullClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException, ClassNotFoundException {
    // Given
    final SimpleClassKeyDeserializer deserialiser = new SimpleClassKeyDeserializer();
    final DeserializationContext context = mock(DeserializationContext.class);
    final Class expectedClass = IsA.class;
    final String id = expectedClass.getName();
    given(context.findClass(expectedClass.getName())).willReturn(expectedClass);

    // When
    final Class<?> clazz = (Class<?>) deserialiser.deserializeKey(id, context);

    // Then
    assertEquals(expectedClass, clazz);
    verify(context).findClass(expectedClass.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:17,代码来源:SimpleClassKeyDeserializerTest.java

示例8: shouldSerialiseToSimpleClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToSimpleClassName() throws IOException, ClassNotFoundException {
    // Given
    SimpleClassNameCache.setUseFullNameForSerialisation(false);
    final SimpleClassSerializer serialiser = new SimpleClassSerializer();
    final JsonGenerator jgen = mock(JsonGenerator.class);
    final Class clazz = IsA.class;

    // When
    serialiser.serialize(clazz, jgen, null);

    // Then
    verify(jgen).writeString(clazz.getSimpleName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:15,代码来源:SimpleClassSerializerTest.java

示例9: shouldSerialiseToFullClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToFullClassName() throws IOException, ClassNotFoundException {
    // Given
    SimpleClassNameCache.setUseFullNameForSerialisation(true);
    final SimpleClassSerializer serialiser = new SimpleClassSerializer();
    final JsonGenerator jgen = mock(JsonGenerator.class);
    final Class clazz = IsA.class;

    // When
    serialiser.serialize(clazz, jgen, null);

    // Then
    verify(jgen).writeString(clazz.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:15,代码来源:SimpleClassSerializerTest.java

示例10: shouldSerialiseToSimpleClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToSimpleClassName() throws IOException, ClassNotFoundException {
    // Given
    SimpleClassNameCache.setUseFullNameForSerialisation(false);
    final SimpleClassKeySerializer serialiser = new SimpleClassKeySerializer();
    final JsonGenerator jgen = mock(JsonGenerator.class);
    final Class clazz = IsA.class;

    // When
    serialiser.serialize(clazz, jgen, null);

    // Then
    verify(jgen).writeFieldName(clazz.getSimpleName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:15,代码来源:SimpleClassKeySerializerTest.java

示例11: shouldSerialiseToFullClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToFullClassName() throws IOException, ClassNotFoundException {
    // Given
    SimpleClassNameCache.setUseFullNameForSerialisation(true);
    final SimpleClassKeySerializer serialiser = new SimpleClassKeySerializer();
    final JsonGenerator jgen = mock(JsonGenerator.class);
    final Class clazz = IsA.class;

    // When
    serialiser.serialize(clazz, jgen, null);

    // Then
    verify(jgen).writeFieldName(clazz.getName());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:15,代码来源:SimpleClassKeySerializerTest.java

示例12: shouldDeserialiseFromSimpleClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException {
    // Given
    final String json = "{\"class\":\"IsA\",\"type\":\"Integer\"}";

    // When
    final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);

    // Then
    assertEquals(Integer.class.getName(), predicate.getType());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:12,代码来源:SimpleClassNameIdResolverTest.java

示例13: shouldDeserialiseFromSimpleClassNameArray

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassNameArray() throws IOException {
    // Given
    final String json = "{\"class\":\"IsA\",\"type\":\"Integer[]\"}";

    // When
    final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);

    // Then
    assertEquals(Integer[].class.getName(), predicate.getType());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:12,代码来源:SimpleClassNameIdResolverTest.java

示例14: shouldDeserialiseFromFullClassName

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException {
    // Given
    final String json = "{\"class\":\"uk.gov.gchq.koryphe.impl.predicate.IsA\",\"type\":\"java.lang.Integer\"}";

    // When
    final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);

    // Then
    assertEquals(Integer.class.getName(), predicate.getType());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:12,代码来源:SimpleClassNameIdResolverTest.java

示例15: shouldDeserialiseFromFullClassNameArray

import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassNameArray() throws IOException {
    // Given
    final String json = "{\"class\":\"uk.gov.gchq.koryphe.impl.predicate.IsA\",\"type\":\"[Ljava.lang.Integer;\"}";

    // When
    final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);

    // Then
    assertEquals(Integer[].class.getName(), predicate.getType());
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:12,代码来源:SimpleClassNameIdResolverTest.java


注:本文中的uk.gov.gchq.koryphe.impl.predicate.IsA类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。