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


Java Portable类代码示例

本文整理汇总了Java中com.hazelcast.nio.serialization.Portable的典型用法代码示例。如果您正苦于以下问题:Java Portable类的具体用法?Java Portable怎么用?Java Portable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
    switch (classId) {
        case ADD:
            return new AddRequest();
        case ADD_ALL:
            return new AddAllRequest();
        case CARDINALITY:
            return new CardinalityRequest();
        case UNION:
            return new UnionRequest();
        case RESET:
            return new ResetRequest();
        default:
            return null;
    }
}
 
开发者ID:buremba,项目名称:hazelcast-modules,代码行数:18,代码来源:HyperLogLogPortableFactory.java

示例2: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
    if (DeviceNotification.CLASS_ID == classId) {
        return new DeviceNotification();
    } else if (DeviceCommand.CLASS_ID == classId) {
        return new DeviceCommand();
    } else if (HivePrincipal.CLASS_ID == classId) {
        return new HivePrincipal();
    } else if (Filter.CLASS_ID == classId) {
        return new Filter();
    } else if (Subscriber.CLASS_ID == classId) {
        return new Subscriber();
    }
    
    return null;
}
 
开发者ID:devicehive,项目名称:devicehive-java-server,代码行数:17,代码来源:DevicePortableFactory.java

示例3: getExtraImplements

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Collection<String> getExtraImplements(JMessage<?> message) throws GeneratorException {
    if (message.hasAnnotation(ThriftAnnotation.JAVA_HAZELCAST_CLASS_ID)) {
        return ImmutableList.of(Portable.class.getName());
    } else {
        return new ArrayList<>();
    }
}
 
开发者ID:morimekta,项目名称:providence,代码行数:9,代码来源:HazelcastPortableMessageFormatter.java

示例4: appendCreateMethod

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
/**
 * Method to write the create method from implemented PortableFactory
 *
 * @param messages List with CStructDescriptor.
 * <pre>
 * {@code
 *  @Override
 *  public com.hazelcast.nio.serialization.Portable create(int classId) {
 *      switch(classId) {
 *          ...
 *          default: {
 *              return null;
 *          }
 *      }
 *  }
 * }
 * </pre>
 */
private void appendCreateMethod(List<CStructDescriptor> messages) {
    writer.appendln("@Override")
          .formatln("public %s create(int classId) {", Portable.class.getName())
          .begin()
          .appendln("switch(classId) {")
          .begin();
    for (CStructDescriptor message : messages) {
        writer.formatln("case %s: {", getHazelcastClassId(message.getName()))
              .begin()
              .formatln("return new %s.%s();",
                        message.getName(),
                        HazelcastPortableMessageFormatter.WRAPPER_CLASS_NAME)
              .end()
              .appendln("}");
    }
    writer.appendln("default: {")
          .begin()
          .appendln("return null;")
          .end()
          .appendln("}")
          .end();
    writer.appendln("}")
          .end()
          .appendln("}")
          .newline();
}
 
开发者ID:morimekta,项目名称:providence,代码行数:45,代码来源:HazelcastPortableProgramFormatter.java

示例5: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
	if (classId == cli_XDMCredentials) {
		return new SecureCredentials();
	}
	return super.create(classId);
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:8,代码来源:PortableFactoryImpl.java

示例6: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
	if (classId == cli_XDMCredentials) {
		return new SecureCredentials();
	}
	return null;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:8,代码来源:PortableFactoryImpl.java

示例7: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
    switch (classId) {
        case ADD:
            return new IncrementByRequest();
        case RESET:
            return new GetRequest();
        default:
            return null;
    }
}
 
开发者ID:buremba,项目名称:hazelcast-modules,代码行数:12,代码来源:TreeMapPortableFactory.java

示例8: createFactory

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public PortableFactory createFactory() {
    return new PortableFactory() {
        @Override
        public Portable create(int classId) {
            switch (classId) {
                case 1:
                    return null;
                default:
                    return null;
            }
        }
    };
}
 
开发者ID:gurbuzali,项目名称:scheduled-executor,代码行数:15,代码来源:ScheduledPortableHook.java

示例9: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
    switch (classId) {
        case ComplexDomainObject.PORTABLE_CLASS_ID:
            return new ComplexDomainObject();
        default:
            return null;
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:10,代码来源:ComplexDomainObjectPortableFactory.java

示例10: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
    switch (classId) {
        case PortableDomainObject.CLASS_ID:
            return new PortableDomainObject();
        default:
            throw new IllegalArgumentException("Unknown class ID" + classId);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:10,代码来源:PortableObjectFactory.java

示例11: create

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int i) {
    return new SillySequencePortable();
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:5,代码来源:MultiValueMapTest.java

示例12: getPortable

import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
public Portable getPortable() {
    SillySequencePortable portable = new SillySequencePortable();
    portable.count = this.count;
    portable.payloadField = ArrayUtils.toPrimitive(payloadField.toArray(new Integer[payloadField.size()]));
    return portable;
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:7,代码来源:ExtractorMapTest.java


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