本文整理了Java中php.runtime.Memory.toObject()
方法的一些代码示例,展示了Memory.toObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.toObject()
方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:toObject
暂无
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory startAndWait(Environment env, Memory... args) throws IOException, InterruptedException {
Memory r = start(env, args);
r.toObject(WrapProcess.class).process.waitFor();
return r;
}
代码示例来源:origin: jphp-group/jphp
@Override
public Date convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) {
return null;
}
return arg.toObject(WrapTime.class).getDate();
}
代码示例来源:origin: jphp-group/jphp
@Override
public Scanner convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) {
return null;
}
return arg.toObject(WrapScanner.class).getScanner();
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("null")))
public Memory getDisplayName(Environment env, Memory... args) {
return StringMemory.valueOf(args[0].isNull()
? locale.getDisplayName()
: locale.getDisplayName(args[0].toObject(WrapLocale.class).locale)
);
}
代码示例来源:origin: jphp-group/jphp
@Override
public Locale convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) {
return null;
}
return arg.toObject(WrapLocale.class).getLocale();
}
代码示例来源:origin: jphp-group/jphp
@Override
@Signature
public Memory rewind(Environment env, Memory... args) {
for (Memory el : iterators) {
env.invokeMethodNoThrow(el.toObject(Iterator.class), "rewind");
}
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Override
public Thread convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) {
return null;
}
return arg.toObject(WrapThread.class).getThread();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void bindTimestamp(Environment env, int index, Memory value) throws SQLException {
if (value.instanceOf(WrapTime.class)) {
WrapTime time = value.toObject(WrapTime.class);
statement.setTimestamp(index + 1, new Timestamp(time.getDate().getTime()), time.getCalendar());
} else {
statement.setTimestamp(index + 1, new Timestamp(value.toLong()));
}
}
代码示例来源:origin: jphp-group/jphp
public static File valueOf(Memory arg) {
if (arg.instanceOf(FileObject.class))
return arg.toObject(FileObject.class).getFile();
else
return new File(arg.toString());
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("format"),
@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("NULL"))
})
public Memory toString(Environment env, Memory... args) {
Locale aLocale = args[1].isNull() ? locale : args[1].toObject(WrapLocale.class).getLocale();
SimpleDateFormat format = new SimpleDateFormat(args[0].toString(), aLocale);
format.setTimeZone(timeZone);
return StringMemory.valueOf(format.format(date));
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "sourceMap", nativeType = WrapSourceMap.class))
public Memory registerSourceMap(Environment env, Memory... args) {
this.environment.registerSourceMap(args[0].toObject(WrapSourceMap.class).getWrappedObject());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Override
public Pattern convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.instanceOf(WrapRegex.class)) {
return arg.toObject(WrapRegex.class).getMatcher().pattern();
} else {
return Pattern.compile(arg.toString());
}
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("name"),
@Arg(value = "parent", typeClass = "php\\lang\\ThreadGroup", optional = @Optional("NULL"))
})
public Memory __construct(Environment env, Memory... args){
if (args[1].isNull())
setGroup(new ThreadGroup(args[0].toString()));
else
setGroup(new ThreadGroup(args[1].toObject(WrapThreadGroup.class).getGroup(), args[0].toString()));
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "locale", nativeType = WrapLocale.class))
public Memory useLocale(Environment env, Memory... args) {
scanner.useLocale(args[0].toObject(WrapLocale.class).getLocale());
return new ObjectMemory(this);
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg(value = "timeZone", nativeType = WrapTimeZone.class, optional = @Optional("null")),
@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("NULL"))
})
public static Memory now(Environment env, Memory... args) {
Locale aLocale = args[1].isNull() ? Locale.ENGLISH : args[1].toObject(WrapLocale.class).getLocale();
TimeZone zone = WrapTimeZone.getTimeZone(env, args[0]);
return new ObjectMemory(new WrapTime(env, Calendar.getInstance(zone, aLocale).getTime(), zone, aLocale));
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void update(Environment env, Memory any) throws Throwable {
if (any.instanceOf(SourceFile.class)) {
SourceFile sourceFile = any.toObject(SourceFile.class);
env.invokeMethod(sourceFile, "update", ObjectMemory.valueOf(this));
}
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("null")))
public Memory getDisplayVariant(Environment env, Memory... args) {
return StringMemory.valueOf(args[0].isNull()
? locale.getDisplayVariant()
: locale.getDisplayVariant(args[0].toObject(WrapLocale.class).locale)
);
}
代码示例来源:origin: jphp-group/jphp
@Override
public ObjectId convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) return null;
if (arg.instanceOf(WrapObjectId.class)) {
return arg.toObject(WrapObjectId.class).getWrappedObject();
}
return new ObjectId(arg.toString());
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("format"),
@Arg(value = "flags", optional = @Optional("0"))
})
public Memory parseAs(Environment env, Memory... args) throws Throwable {
FileStream fileStream = open(env, StringMemory.valueOf("r")).toObject(FileStream.class);
try {
return fileStream.parseAs(env, args);
} finally {
fileStream.close(env);
}
}
代码示例来源:origin: jphp-group/jphp
@Signature({@Arg(value = "object", optional = @Optional, type = HintType.OBJECT)})
public Memory invoke(Environment env, Memory... args) throws Throwable {
Memory self = args[0];
Memory[] arguments = args.length == 1 ? new Memory[0] : Arrays.copyOfRange(args, 1, args.length - 1);
Invoker invoker;
if (self.isNull()) {
invoker = new StaticMethodInvoker(env, env.trace(), methodEntity.getClazzName(), methodEntity);
} else {
invoker = new DynamicMethodInvoker(env, env.trace(), self.toObject(IObject.class), methodEntity);
}
return invoker.call(arguments);
}
内容来源于网络,如有侵权,请联系作者删除!