本文整理汇总了Java中clojure.lang.PersistentArrayMap类的典型用法代码示例。如果您正苦于以下问题:Java PersistentArrayMap类的具体用法?Java PersistentArrayMap怎么用?Java PersistentArrayMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersistentArrayMap类属于clojure.lang包,在下文中一共展示了PersistentArrayMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, Long requestId) {
this.collector = collector;
this.requestId = requestId;
try{
if(serializers == null){
serializers = new HashMap<String, CVParticleSerializer<? extends CVParticle>>();
PersistentArrayMap map = (PersistentArrayMap)conf.get(Config.TOPOLOGY_KRYO_REGISTER);
for(Object className : map.keySet()){
serializers.put((String)className, (CVParticleSerializer<? extends CVParticle>)Class.forName((String)map.get(className)).newInstance());
}
}
if(batchOp != null) batchOp.initBatch(conf, context);
if(resultOp != null) resultOp.initBatch(conf, context);
}catch(Exception e){
logger.error("Unable to prepare CVParticleBolt due to ",e);
}
}
示例2: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
this.collector = collector;
this.boltName = context.getThisComponentId();
try{
PersistentArrayMap map = (PersistentArrayMap)conf.get(Config.TOPOLOGY_KRYO_REGISTER);
for(Object className : map.keySet()){
serializers.put((String)className, (CVParticleSerializer<? extends CVParticle>)Class.forName((String)map.get(className)).newInstance());
}
}catch(Exception e){
logger.error("Unable to prepare CVParticleBolt due to ",e);
}
this.prepare(conf, context);
}
示例3: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword,Object> collectorMap = new PersistentArrayMap( new Object[] {
Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context});
List<Object> args = new ArrayList<Object>() {{
add(stormConf);
add(context);
add(collectorMap);
}};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
//this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch(AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例4: open
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword,Object> collectorMap = new PersistentArrayMap( new Object[] {
Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context});
List<Object> args = new ArrayList<Object>() {{
add(conf);
add(context);
add(collectorMap);
}};
_spout = (ISpout) preparer.applyTo(RT.seq(args));
//this is kind of unnecessary for clojure
try {
_spout.open(conf, context, collector);
} catch(AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: getObject
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
public Map<?, ?> getObject(final String command) throws Exception {
// final String[] execArgs = command.split(" ");
// final StringBuilder commandArgs = new StringBuilder();
// for (String arg : execArgs) {
// commandArgs.append("\" \"");
// commandArgs.append(arg);
// }
// commandArgs.append("\"");
// final String clojurePayload =
// String.format("(use '[clojure.java.shell :only [sh]]) (sh %s)", commandArgs.substring(2));
String cmd = Strings.join(Arrays.asList(command.replaceAll("\\\\","\\\\\\\\").replaceAll("\"","\\").split(" ")), " ", "\"", "\"");
final String clojurePayload =
String.format("(use '[clojure.java.shell :only [sh]]) (sh %s)", cmd);
Map<String, Object> fnMap = new HashMap<String, Object>();
fnMap.put("hashCode", new clojure.core$constantly().invoke(0));
AbstractTableModel$ff19274a model = new AbstractTableModel$ff19274a();
model.__initClojureFnMappings(PersistentArrayMap.create(fnMap));
HashMap<Object, Object> targetMap = new HashMap<Object, Object>();
targetMap.put(model, null);
fnMap.put("hashCode",
new clojure.core$comp().invoke(
new clojure.main$eval_opt(),
new clojure.core$constantly().invoke(clojurePayload)));
model.__initClojureFnMappings(PersistentArrayMap.create(fnMap));
return targetMap;
}
示例6: toMap
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
Object array[] = new Object[values.size() * 2];
List<String> fields = getFields().toList();
for (int i = 0; i < values.size(); i++) {
array[i * 2] = fields.get(i);
array[(i * 2) + 1] = values.get(i);
}
return new PersistentArrayMap(array);
}
示例7: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
/**
*
*/
private static final long serialVersionUID = 8969454649175064263L;
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例8: open
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context,
final SpoutOutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
/**
*
*/
private static final long serialVersionUID = 9036954267397717931L;
{
add(conf);
add(context);
add(collectorMap);
}
};
_spout = (ISpout) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_spout.open(conf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例9: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例10: open
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context,
final SpoutOutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(conf);
add(context);
add(collectorMap);
}
};
_spout = (ISpout) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_spout.open(conf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例11: wrapping
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Test
public void wrapping() throws Exception {
PersistentHashSet persistentHashSet = PersistentHashSet.create();
PersistentVector persistentVector = PersistentVector.create();
PersistentArrayMap persistentArrayMap = PersistentArrayMap.EMPTY;
ClojureSet clojureSet = intoClojureSet(persistentHashSet);
ClojureList clojureList = intoClojureList(persistentVector);
ClojureMap clojureMap = intoClojureMap(persistentArrayMap);
Field setDelegate = ClojureSet.class.getDeclaredField("delegate");
Field listDelegate = ClojureList.class.getDeclaredField("delegate");
Field mapDelegate = ClojureMap.class.getDeclaredField("delegate");
setDelegate.setAccessible(true);
listDelegate.setAccessible(true);
mapDelegate.setAccessible(true);
assertSame(setDelegate.get(clojureSet), persistentHashSet);
assertSame(listDelegate.get(clojureList), persistentVector);
assertSame(mapDelegate.get(clojureMap), persistentArrayMap);
}
示例12: toMap
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
Object array[] = new Object[values.size() * 2];
List<String> fields = getFields().toList();
for (int i = 0; i < values.size(); i++) {
array[i * 2] = fields.get(i);
array[(i * 2) + 1] = values.get(i);
}
return new PersistentArrayMap(array);
}
示例13: prepare
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap =
new PersistentArrayMap(new Object[] { Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例14: open
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap =
new PersistentArrayMap(new Object[] { Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(conf);
add(context);
add(collectorMap);
}
};
_spout = (ISpout) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_spout.open(conf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例15: toMap
import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
Object array[] = new Object[values.size()*2];
List<String> fields = getFields().toList();
for(int i=0; i < values.size(); i++) {
array[i*2] = fields.get(i);
array[(i*2)+1] = values.get(i);
}
return new PersistentArrayMap(array);
}