本文整理汇总了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;
}
}
示例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;
}
示例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<>();
}
}
示例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();
}
示例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);
}
示例6: create
import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int classId) {
if (classId == cli_XDMCredentials) {
return new SecureCredentials();
}
return null;
}
示例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;
}
}
示例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;
}
}
};
}
示例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;
}
}
示例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);
}
}
示例11: create
import com.hazelcast.nio.serialization.Portable; //导入依赖的package包/类
@Override
public Portable create(int i) {
return new SillySequencePortable();
}
示例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;
}