info.magnolia.objectfactory.Components.newInstance()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(158)

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

Components.newInstance介绍

暂无

代码示例

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

@Override
protected UploadReceiver createReceiver() {
  return Components.newInstance(AssetUploadReceiver.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
   * Override this method if you need to provide a specific subclass of AggregationState.
   */
  protected AggregationState newAggregationState() {
    return Components.newInstance(AggregationState.class);
  }
}

代码示例来源:origin: info.magnolia.form/magnolia-form

@Override
  protected StartStepFormEngine createFormEngine() {
    return Components.newInstance(StartStepFormEngine.class, content, definition);
  }
}

代码示例来源:origin: info.magnolia.form/magnolia-form

@Override
protected FormDataBinder getFormDataBinder() {
  FormDataBinder formDataBinder = Components.newInstance(FormDataBinder.class);
  return formDataBinder;
}

代码示例来源:origin: info.magnolia/magnolia-module-standard-templating-kit

public NavigationItem(Node content, SubNavigation parent, int depth, boolean allOpen) {
  super(content, parent, depth, allOpen);
  link = Components.newInstance(Link.class, content);
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

@Override
protected T initializeUploadReceiver() {
  return (T) Components.newInstance(AssetUploadReceiver.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

private DefaultRepositoryStrategy createRepositoryStrategy() {
  return Components.newInstance(DefaultRepositoryStrategy.class, this);
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * @deprecated since version 5.2.2, more detailed c-tor should be used
 * in order to handle upload button availability properly.
 */
@Deprecated
public UploadAssetActionRenderer(UiContext layer, SimpleTranslator i18n) {
  this.layer = layer;
  this.i18n = i18n;
  receiver = Components.newInstance(AssetUploadReceiver.class, i18n);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public JCRSessionStrategy getRepositoryStrategy() {
  if (repositoryStrategyThreadLocal.get() == null) {
    repositoryStrategyThreadLocal.set(Components.newInstance(SystemRepositoryStrategy.class));
  }
  return repositoryStrategyThreadLocal.get();
}

代码示例来源:origin: info.magnolia/magnolia-core

public SingleJCRSessionSystemContext() {
  this.setRepositoryStrategy(Components.newInstance(SystemRepositoryStrategy.class));
}

代码示例来源:origin: info.magnolia/magnolia-rendering

/**
 * The instance of each {@link AbstractRenderingListener} needs to be copied per request.
 * Override this method to set your custom properties which should be shared between all instances.
 */
public AbstractRenderingListener copy() { // no need to copy enabled field since such node is disabled by N2B
  AbstractRenderingListener copy = Components.newInstance(this.getClass());
  copy.setShouldProcess(shouldProcess);
  return copy;
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Override
public Comparator<Node> getComponentComparator() {
  if (nodeComparatorClass != null) {
    return Components.newInstance(nodeComparatorClass);
  }
  return new NodeDepthComparator();
}

代码示例来源:origin: info.magnolia/magnolia-core

protected ModuleVersionHandler newVersionHandler(ModuleDefinition module) {
  try {
    final Class<? extends ModuleVersionHandler> versionHandlerClass = module.getVersionHandler();
    if (versionHandlerClass != null) {
      return Components.newInstance(versionHandlerClass);
    }
    return new DefaultModuleVersionHandler();
  } catch (MgnlInstantiationException e) {
    throw e; // TODO
  }
}

代码示例来源:origin: info.magnolia/magnolia-templating

@Override
  public void doExec() throws RepositoryException {
    Node areaNodeInSystemSession = NodeUtil.getNodeByIdentifier(workspaceName, areaId);
    try {
      ((Generator<AutoGenerationConfiguration>) Components.newInstance(autoGeneration.getGeneratorClass(), areaNodeInSystemSession)).generate(autoGeneration);
    } catch (RenderException e) {
      log.error("Can't render autogenerated area '{}'.", areaNodeInSystemSession);
    }
    return;
  }
});

代码示例来源:origin: info.magnolia.dam/magnolia-dam-jcr

@Override
public <M extends AssetMetadata> M getMetadata(Class<M> metaDataType) {
  if (!getAssetProvider().supports(metaDataType)) {
    throw new IllegalArgumentException("Unsupported metaData Type requested " + metaDataType != null ? metaDataType.getName() : "null");
  }
  return Components.newInstance(metaDataType, getNode(), getItemKey());
}

代码示例来源:origin: info.magnolia/magnolia-core

private Node prepareVersionedNode() throws Exception {
    Session session = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE);
    Node node = session.getRootNode().addNode("test", NodeTypes.Content.NAME);

    Version version = Components.newInstance(VersionManager.class).addVersion(node);

    versionCreationTime.setTime(version.getCreated().getTime());
    activationTime.add(Calendar.HOUR, 10);

    node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED, activationTime);
    node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED_VERSION, version.getName());
    node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED_VERSION_CREATED, versionCreationTime);
    node.setProperty(NodeTypes.Activatable.ACTIVATION_STATUS, true);

    return node;
  }
}

代码示例来源:origin: net.sourceforge.openutils/openutils-mgnltests

protected void modifyContextesToUseRealRepository()
{
  // create a mock web context with same repository acquiring strategy as the system context
  MockContext systemContext = (MockContext) MgnlContext.getSystemContext();
  SystemRepositoryStrategy repositoryStrategy = Components.newInstance(SystemRepositoryStrategy.class);
  systemContext.setRepositoryStrategy(repositoryStrategy);
  MockContext ctx = (MockContext) MgnlContext.getInstance();
  ctx.setRepositoryStrategy(repositoryStrategy);
  
  systemContext.setUser(new DummyUser());
  ctx.setUser(new DummyUser());  
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Before
public void setUp() throws Exception {
  ComponentsTestUtil.setImplementation(AvailabilityDefinition.class, ConfiguredAvailabilityDefinition.class);
  ComponentsTestUtil.setImplementation(ActionbarView.class, ActionbarViewImpl.class);
  ComponentsTestUtil.setInstance(SimpleTranslator.class, mock(SimpleTranslator.class));
  presenter = Components.newInstance(ActionbarPresenter.class);
  definition = initDefinitions();
}

代码示例来源:origin: info.magnolia/magnolia-core

protected void modifyContextesToUseRealRepository() {
  this.userContextRepositoryStrategy = Components.newInstance(SystemRepositoryStrategy.class);
  // create a mock web context with same repository acquiring strategy as the system context
  final MockContext systemContext = (MockContext) MgnlContext.getSystemContext();
  systemContext.setRepositoryStrategy(Components.newInstance(SystemRepositoryStrategy.class));
  MockContext ctx = (MockContext) MgnlContext.getInstance();
  ctx.setRepositoryStrategy(userContextRepositoryStrategy);
  systemContext.setUser(new DummyUser());
  ctx.setUser(new DummyUser());
}

代码示例来源:origin: info.magnolia/magnolia-core

protected void modifyContextesToUseRealRepository() {
  // create a mock web context with same repository acquiring strategy as the system context
  MockContext systemContext = (MockContext) MgnlContext.getSystemContext();
  SystemRepositoryStrategy repositoryStrategy = Components.newInstance(SystemRepositoryStrategy.class);
  systemContext.setRepositoryStrategy(repositoryStrategy);
  MockContext ctx = (MockContext) MgnlContext.getInstance();
  ctx.setRepositoryStrategy(repositoryStrategy);
  systemContext.setUser(new DummyUser());
  ctx.setUser(new DummyUser());
}

相关文章