org.xwiki.context.ExecutionContext.newProperty()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(69)

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

ExecutionContext.newProperty介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.commons/xwiki-commons-context

/**
 * @param key the key under which to save the passed property value
 * @param value the value to set
 */
public void setProperty(String key, Object value)
{
  ExecutionContextProperty property = this.properties.get(key);
  if (property == null) {
    LOGGER.debug("Implicit declaration of property {}.", key);
    newProperty(key).declare();
    property = this.properties.get(key);
  } else if (property.isFinal()) {
    throw new PropertyIsFinalException(key);
  }
  property.setValue(value);
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-localization-api

/**
 * @return the current bundles
 */
private Map<String, SortedSet<TranslationBundle>> getBundlesInternal()
{
  Map<String, SortedSet<TranslationBundle>> bundles;
  ExecutionContext context = this.execution.getContext();
  if (context != null) {
    bundles = (Map<String, SortedSet<TranslationBundle>>) context.getProperty(CKEY_BUNDLES);
    if (bundles == null) {
      // Register the Execution Context property with an empty map that will be populated for each wiki.
      bundles = new HashMap<>();
      context.newProperty(CKEY_BUNDLES).inherited().cloneValue().initial(bundles).declare();
    }
  } else {
    bundles = new HashMap<>();
  }
  return bundles;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-async-api

/**
 * Push a new {@link ContextUse} in the context.
 */
public void pushContextUse()
{
  ExecutionContext econtext = this.execution.getContext();
  if (econtext != null) {
    Deque<ContextUse> deque = (Deque<ContextUse>) econtext.getProperty(KEY_CONTEXTUSE);
    if (deque == null) {
      deque = new LinkedList<>();
      DeclarationBuilder propertyBuilder = econtext.newProperty(KEY_CONTEXTUSE);
      propertyBuilder.inherited();
      propertyBuilder.makeFinal();
      propertyBuilder.initial(deque);
      propertyBuilder.declare();
    }
    deque.push(new ContextUse());
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-url-api

@Override
  public void initialize(ExecutionContext context) throws ExecutionContextException
  {
    if (!context.hasProperty(DefaultURLContextManager.CONTEXT_KEY)) {
      context.newProperty(DefaultURLContextManager.CONTEXT_KEY)
        .inherited()
        .initial(this.configuration.getURLFormatId())
        .declare();
    }
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-lesscss-default

private void setProperty(String propertyName, Object value)
  {
    Object property = getContext().getProperty(propertyName);
    if (property != null) {
      getContext().setProperty(propertyName, value);
    } else {
      getContext().newProperty(propertyName).inherited().initial(value).declare();
    }
  }
}

代码示例来源:origin: org.xwiki.commons/xwiki-commons-velocity

@Override
  public void initialize(ExecutionContext executionContext) throws ExecutionContextException
  {
    try {
      if (!executionContext.hasProperty(VELOCITY_CONTEXT_ID)) {
        VelocityContext context = this.velocityContextFactory.createContext();
        executionContext.newProperty(VELOCITY_CONTEXT_ID)
          .cloneValue()
          .inherited()
          .initial(context)
          .declare();
      }
    } catch (XWikiVelocityException e) {
      throw new ExecutionContextException("Failed to initialize Velocity Context", e);
    }
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-container-servlet

ec.setProperty(key, xwikiContext);
} else {
  ec.newProperty(key).inherited().initial(xwikiContext).declare();

相关文章