clojure.lang.Namespace.getAliases()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中clojure.lang.Namespace.getAliases()方法的一些代码示例,展示了Namespace.getAliases()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getAliases()方法的具体详情如下:
包路径:clojure.lang.Namespace
类名称:Namespace
方法名:getAliases

Namespace.getAliases介绍

暂无

代码示例

代码示例来源:origin: org.dunaj/clojure

public Namespace lookupAlias(Symbol alias){
  IPersistentMap map = getAliases();
  return (Namespace) map.valAt(alias);
}

代码示例来源:origin: org.dunaj/clojure

public void removeAlias(Symbol alias) {
  IPersistentMap map = getAliases();
  while(map.containsKey(alias))
    {
    IPersistentMap newMap = map.without(alias);
    aliases.compareAndSet(map, newMap);
    map = getAliases();
    }
}

代码示例来源:origin: videlalvaro/clochure

public void removeAlias(Symbol alias) {
  IPersistentMap map = getAliases();
  while(map.containsKey(alias))
    {
    IPersistentMap newMap = map.without(alias);
    aliases.compareAndSet(map, newMap);
    map = getAliases();
    }
}

代码示例来源:origin: videlalvaro/clochure

public Namespace lookupAlias(Symbol alias){
  IPersistentMap map = getAliases();
  return (Namespace) map.valAt(alias);
}

代码示例来源:origin: videlalvaro/clochure

public void addAlias(Symbol alias, Namespace ns){
  if (alias == null || ns == null)
    throw new NullPointerException("Expecting Symbol + Namespace");
  IPersistentMap map = getAliases();
  while(!map.containsKey(alias))
    {
    IPersistentMap newMap = map.assoc(alias, ns);
    aliases.compareAndSet(map, newMap);
    map = getAliases();
    }
  // you can rebind an alias, but only to the initially-aliased namespace.
  if(!map.valAt(alias).equals(ns))
    throw new IllegalStateException("Alias " + alias + " already exists in namespace "
                      + name + ", aliasing " + map.valAt(alias));
}

代码示例来源:origin: org.dunaj/clojure

public void addAlias(Symbol alias, Namespace ns){
  if (alias == null || ns == null)
    throw new NullPointerException("Expecting Symbol + Namespace");
  IPersistentMap map = getAliases();
  while(!map.containsKey(alias))
    {
    IPersistentMap newMap = map.assoc(alias, ns);
    aliases.compareAndSet(map, newMap);
    map = getAliases();
    }
  // you can rebind an alias, but only to the initially-aliased namespace.
  if(!map.valAt(alias).equals(ns))
    throw new IllegalStateException("Alias " + alias + " already exists in namespace "
                      + name + ", aliasing " + map.valAt(alias));
}

相关文章