List of usage examples for jdk.nashorn.internal.objects NativeRegExp constructor
@SpecializedFunction(isConstructor = true) public static NativeRegExp constructor(final boolean isNew, final Object self, final Object pattern, final Object flags)
From source file:com.mongodb.jvm.json.nashorn.NativeRegExpTransformer.java
License:Apache License
public Object transform(Object object, JsonImplementation implementation) { if (object instanceof ScriptObject) { ScriptObject scriptObject = (ScriptObject) object; Object regex = scriptObject.get("$regex"); if ((regex != null) && (regex.getClass() != Undefined.class)) { Object options = scriptObject.get("$options"); if ((options != null) && (options.getClass() != Undefined.class)) NativeRegExp.constructor(true, null, regex.toString(), options.toString()); else//from w w w .j a v a 2s .c o m NativeRegExp.constructor(true, null, regex.toString()); } } return null; }
From source file:com.threecrickets.jvm.json.nashorn.util.NashornNativeUtil.java
License:Mozilla Public License
public static NativeRegExp toRegExp(String source, String optionsString) { return (NativeRegExp) NativeRegExp.constructor(true, null, source, optionsString); }
From source file:org.bson.jvm.nashorn.NativeRegExpCodec.java
License:Apache License
public NativeRegExp decode(BsonReader reader, DecoderContext decoderContext) { BsonRegularExpression bsonRegularExpression = reader.readRegularExpression(); return (NativeRegExp) NativeRegExp.constructor(true, null, bsonRegularExpression.getPattern(), bsonRegularExpression.getOptions()); }