本文整理了Java中com.atlassian.plugin.Plugin.loadClass()
方法的一些代码示例,展示了Plugin.loadClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.loadClass()
方法的具体详情如下:
包路径:com.atlassian.plugin.Plugin
类名称:Plugin
方法名:loadClass
暂无
代码示例来源:origin: org.randombits.confluence/confluence-conveyor
public boolean matches( Plugin plugin ) {
try {
Class<?> loadedClass = plugin.loadClass( DefaultOverrideManager.class.getName(), null );
Class<?> myClass = DefaultOverrideManager.class;
return loadedClass == myClass;
} catch ( ClassNotFoundException e ) {
return false;
}
}
} ) ) {
代码示例来源:origin: com.atlassian.jira/jira-core
BlockRenderer loadBlockRenderer(String blockRendererClassName, Plugin plugin)
throws ClassNotFoundException
{
Class blockRendererClass = plugin.loadClass(blockRendererClassName, getClass());
return (BlockRenderer) JiraUtils.loadComponent(blockRendererClass);
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-osgi
@Override
protected void loadClass(Plugin plugin, String clazz) throws PluginParseException {
try {
// this should have been done once by the plugin container so should never throw exception.
this.moduleClass = plugin.loadClass(clazz, null);
} catch (ClassNotFoundException e) {
throw new PluginParseException("cannot load component class", e);
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-schema
private <T> Class<? extends T> findClass(String className, Class<T> castTo) {
checkNotNull(className);
Class<T> clazz;
try {
clazz = plugin.loadClass(className, getClass());
} catch (ClassNotFoundException e) {
throw new PluginParseException("Unable to find class " + className);
}
return clazz.asSubclass(castTo);
}
代码示例来源:origin: com.atlassian.streams/streams-spi
@SuppressWarnings("unchecked")
private <A> Class<? extends A> loadSubModuleClass(String subModuleName, String subModuleClassName, Class<A> subModuleClassParentType)
{
if (subModuleClassName == null)
{
return null;
}
try
{
final Class<?> subModuleClass = plugin.loadClass(subModuleClassName, this.getClass());
if (!subModuleClassParentType.isAssignableFrom(subModuleClass))
{
throw new IllegalArgumentException("Sub module '" + subModuleName + "' class '" + subModuleClassName + "' must be of type '" + subModuleClassParentType.getName() + "'");
}
return (Class<? extends A>) subModuleClass;
}
catch (ClassNotFoundException e)
{
throw new IllegalArgumentException("Sub module '" + subModuleName + "' class '" + subModuleClassName + "' not found ");
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-schema-plugin
private <T> Class<? extends T> findClass(String className, Class<T> castTo)
{
checkNotNull(className);
Class<T> clazz = null;
try
{
clazz = plugin.loadClass(className, getClass());
}
catch (ClassNotFoundException e)
{
throw new PluginParseException("Unable to find class " + className);
}
return clazz.asSubclass(castTo);
}
代码示例来源:origin: com.atlassian.applinks/applinks-common
@Override
public void enabled() {
super.enabled();
try {
this.manifestProducerClass = plugin.loadClass(manifestProducerClassName, getModuleClass());
} catch (ClassNotFoundException cnfe) {
throw new IllegalStateException("Unable to load this application type's " +
ManifestProducer.class.getSimpleName() + " class.", cnfe);
}
}
代码示例来源:origin: org.randombits.confluence/confluence-conveyor
private <T> T loadClass( String className, Class<T> type ) {
Class cls = null;
try {
cls = plugin.loadClass( className, getClass() );
return type.cast( ConfluencePluginUtils.instantiatePluginModule( plugin, cls ) );
} catch ( ClassNotFoundException e ) {
throw new PluginParseException( "Unable to load the condition class: " + className );
}
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin
@Override
public void enabled() {
super.enabled();
try {
this.manifestProducerClass = plugin.loadClass(manifestProducerClassName, getModuleClass());
} catch (ClassNotFoundException cnfe) {
throw new IllegalStateException("Unable to load this application type's " +
ManifestProducer.class.getSimpleName() + " class.", cnfe);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public Condition loadCondition(final String className, final Plugin plugin) throws ConditionLoadingException
{
try
{
final Class<Condition> conditionClass = plugin.loadClass(className, getClass());
return PluginInjector.newInstance(conditionClass, plugin);
}
catch (Exception e)
{
throw new ConditionLoadingException("Could not load '" + className + "' in plugin " + plugin, e);
}
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core
@Override
public void enabled()
{
super.enabled();
try
{
this.manifestProducerClass = plugin.loadClass(manifestProducerClassName, getModuleClass());
}
catch (ClassNotFoundException cnfe)
{
throw new IllegalStateException("Unable to load this application type's " +
ManifestProducer.class.getSimpleName() + " class.", cnfe);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public void enabled()
{
// Note that components loaded as plugins2 will use the com.atlassian.plugin.osgi.factory.descriptor.ComponentModuleDescriptor
if (interfaceClazzName != null)
{
// Load the interfaceClazz now that the OSGi bundle will be available.
try
{
interfaceClazz = plugin.loadClass(interfaceClazzName, getClass());
}
catch (final Exception e)
{
throw new PluginException("Unable to load interface class: " + interfaceClazzName, e);
}
}
super.enabled();
}
代码示例来源:origin: com.atlassian.prettyurls/atlassian-pretty-urls-plugin
private <T> T autowire(final String className, final Plugin plugin) {
try {
Class<T> conditionClass = plugin.loadClass(className, getClass());
if (plugin instanceof ContainerManagedPlugin) {
return ((ContainerManagedPlugin) plugin).getContainerAccessor().createBean(conditionClass);
} else {
return hostContainer.create(conditionClass);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
private <T> T getObjectFromClassName(final String className, final Class<T> castClass)
{
if (!(plugin instanceof ContainerManagedPlugin))
{
throw new IllegalStateException("Plugin object has to implement a ContainerManagedPlugin interface.");
}
try
{
final Class<Object> clazz = plugin.loadClass(className, getClass());
final Object bean = ((ContainerManagedPlugin) plugin).getContainerAccessor().createBean(clazz);
return castClass.cast(bean);
}
catch (ClassNotFoundException e)
{
throw new PluginParseException("Error finding object descriptor class:" + className, e);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Checks if the given class exists.
*
* @param className a class name
* @return className if it exists. Null otherwise.
*/
private String checkClassExists(String className)
{
if (isBlank(className))
{
return null;
}
try
{
// Here we just check whether the class exists; in the ProjectTemplateModule we'll check whether it is an instance of AddProjectHook.
// We can't do it the other way around because we would be creating a class of a non-initialized project-create-hook module descriptor.
getPlugin().loadClass(className, this.getClass());
return className;
}
catch (ClassNotFoundException e)
{
throw new PluginException("Class '" + className + "' not found.", e);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public void enabled()
{
if (log.isDebugEnabled())
{
log.debug(String.format("Plugin '%s' is attempting to register workflow module '%s'.", getKey(), implementationClassName));
}
try
{
implementationClass = getPlugin().loadClass(implementationClassName, getClass());
}
catch (final ClassNotFoundException ex)
{
throw new PluginException("Cannot load condition class '" + implementationClassName + "'. " + ex.getMessage());
}
// Load the implementation class now that the OSGi bundle will be available
super.enabled();
registerWorkflowTypeResolver();
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-webresource
public static <T> T create(Plugin plugin, Class<?> callingClass, HostContainer hostContainer, String className)
throws ClassNotFoundException
{
Class<T> clazz = plugin.loadClass(className, callingClass);
if (plugin instanceof ContainerManagedPlugin)
{
return ((ContainerManagedPlugin) plugin).getContainerAccessor().createBean(clazz);
}
else
{
return hostContainer.create(clazz);
}
}
}
代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-web-item-plugin
public Condition loadCondition(String className, Plugin plugin) throws ConditionLoadingException {
try {
if (plugin instanceof ContainerManagedPlugin) {
Class conditionClass = plugin.loadClass(className, getClass());
return (Condition) ((ContainerManagedPlugin) plugin).getContainerAccessor().createBean(conditionClass);
} else {
throw new ConditionLoadingException("Plugin " + plugin.getKey() + " is not a ContainerManagedPlugin, could not load condition.");
}
} catch (IllegalArgumentException e) {
throw new ConditionLoadingException(e);
} catch (ClassNotFoundException e) {
throw new ConditionLoadingException(e);
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
<T> Class<T> getModuleClass(final String name, final ModuleDescriptor moduleDescriptor) throws ModuleClassNotFoundException {
try {
return moduleDescriptor.getPlugin().loadClass(name, null);
} catch (ClassNotFoundException e) {
throw new ModuleClassNotFoundException(name, moduleDescriptor.getPluginKey(), moduleDescriptor.getKey(), e, createErrorMsg(name));
}
}
代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-web-item-plugin
public ContextProvider loadContextProvider(String className, Plugin plugin) throws ConditionLoadingException {
try {
if (plugin instanceof ContainerManagedPlugin) {
Class conditionClass = plugin.loadClass(className, getClass());
return (ContextProvider) ((ContainerManagedPlugin) plugin).getContainerAccessor().createBean(conditionClass);
} else {
throw new ConditionLoadingException("Plugin " + plugin.getKey() + " is not a ContainerManagedPlugin, could not load context.");
}
} catch (IllegalArgumentException e) {
throw new ConditionLoadingException(e);
} catch (ClassNotFoundException e) {
throw new ConditionLoadingException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!