Gets the package resource reference.

@param componentClass
the component class
@return the package resource reference
431699
public Set<PackageResourceReferenceWrapper> getPackageResourceReference(
		final Class<?> componentClass)
	{
		Set<PackageResourceReferenceWrapper> packageResourceReference = PackageResourceReferences
			.getInstance().getPackageResourceReferenceMap().get(componentClass);
		packageResourceReference = addPackageResourceReferenceFromInterfaces(
			packageResourceReference, componentClass);
		return packageResourceReference;
	}
260979
public static <T> T getInstance(Class<T> beanClass) {
		return (T) getInstanceProvider().getInstance(beanClass);
	}
128710
public ResourceBundle getResourceBundle(Class<?> aClass, String bundleName, Locale locale) {
        return getResourceBundle(aClass, bundleName, (locale == null) ? null : Collections.singletonList(locale));
    }
1114294
private ClassLoader getClassLoaderFromBundle(Object resource, String packageName, String versionRange)
    {
    	ClassLoader classLoader = null;
        if (resource == null)
        {
            Object classAccess = this.getClassBundleService(null, packageName + FAKE_CLASSNAME, versionRange, null, 0);
            if (classAccess != null)
            {
            	classLoader = classAccess.getClass().getClassLoader();
            }
        }
        else
        {
        	Bundle bundle = this.findBundle(resource, bundleContext, packageName, versionRange);
        	if (bundle == null)
        		return null;
        	@SuppressWarnings("unchecked")
			Enumeration<URL> entries = bundle.findEntries(packageName.replace('.', '/'), "*.class", true);
        	if (entries != null)
        		if (entries.hasMoreElements())
        	{	// This is kind of a hokey way to get the classloader from a bundle - find a class file and load it - but it works.
        		URL url = entries.nextElement();
        		String path = url.getFile();
        		int start = path.startsWith("/") ? 1 : 0;	// Path should always start at the root.
        		path = path.substring(start, path.lastIndexOf('.')).replace('/', '.');
        		try {
					classLoader = bundle.loadClass(path).getClassLoader();
				} catch (ClassNotFoundException e) {
					e.printStackTrace();
				}
        	}
        }
        return classLoader;
    }
907447
private static File _getClassSource (final Class <?> type)
  {
    if (type != null)
    {
      final String classResource = type.getName ().replace ('.', '/') + ".class";
      return _getResourceSource (classResource, type.getClassLoader ());
    }
    return null;
  }
1325081
public static SortedSet<String> getClassesForPackage(Package pkg, ClassLoader classLoader) {
        SortedSet<String> classes = new TreeSet<>(new Comparator<String>() {
           public int compare(String o1, String o2) {
              String simpleName1 = getSimpleName(o1);
              String simpleName2 = getSimpleName(o2);
              return simpleName1.compareTo(simpleName2);
           }

           private String getSimpleName(String className) {
              return className.substring(className.lastIndexOf('.'));
           }
        });

        String pkgname = pkg.getName();
        String relPath = pkgname.replace('.', '/');

        // Get a File object for the package
        Enumeration<URL> resources;
        try {
            resources = classLoader.getResources(relPath);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        while(resources.hasMoreElements()) {
            URL resource = resources.nextElement();
            if (resource.toString().startsWith("jar:")) {
                processJarfile(resource, pkgname, classes);
            } else {
                processDirectory(new File(resource.getPath()), pkgname, classes);
            }
        }

        return classes;
    }
504958
@Override
	@Description("Gets all of th resource types which have bound Component Bindings Providers")
	public String[] getLoadedResourceTypes() {
		Set<String> types = ((ComponentBindingsProviderFactoryImpl) componentBindingsProviderFactory)
				.getLoadedResourceTypes();
		return types.toArray(new String[types.size()]);
	}
833029
public ResourceBundle getRecordResource(Class<?> classResource, Locale locale)
    {
        ClassLoader classLoader = this.getClass().getClassLoader();
        ResourceBundle resourceBundle = null;
        String typicalResourceClassName = null;
        try   {
            typicalResourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, 2) + "Resources";
            resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(typicalResourceClassName, locale, null, classLoader);
        } catch (MissingResourceException ex) {
            resourceBundle = null;
        }
        int i = -1;
        while (resourceBundle == null)
        {
            String resourceClassName = Util.convertClassName(classResource.getName(), Constants.RES_SUBPACKAGE, i);
            if (resourceClassName == null)
                return null;
            if (resourceClassName.equals(typicalResourceClassName))
                return null;    // Looked through them all
            resourceClassName = resourceClassName + "Resources";
            try   {
                resourceBundle = ClassServiceUtility.getClassService().getResourceBundle(resourceClassName, locale, null, classLoader);
            } catch (MissingResourceException ex) {
                resourceBundle = null;
            }
            i--;
        }
        return resourceBundle;
    }
693712
private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
        try {
            return ResourceBundle.getBundle(baseName, locale, classLoader);
        } catch (MissingResourceException e) {
            // fall through and return null.
            logger.finer(e.getMessage());
        }
        return null;
    }
17865
protected Class<? extends SlingBean> getComponentType() throws ClassNotFoundException {
        if (componentType == null) {
            String type = getType();
            if (StringUtils.isNotBlank(type)) {
                componentType = (Class<? extends SlingBean>) context.getType(type);
            }
        }
        return componentType;
    }
50859
public static URL getResource(String resource, Class<?> baseClass) {
		return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
	}
7754
public List<WarningsGroup> getByComponent(Class<? extends ICalComponent> componentClass) {
		List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
		for (WarningsGroup group : this.warnings) {
			ICalComponent component = group.getComponent();
			if (component == null) {
				continue;
			}

			if (componentClass == component.getClass()) {
				warnings.add(group);
			}
		}
		return warnings;
	}
1106603
@Override
	public List<ComponentBindingsProvider> getComponentBindingsProviders(
			String resourceType) {
		List<ComponentBindingsProvider> cis = new ArrayList<ComponentBindingsProvider>();
		for (ServiceReference reference : getReferences(resourceType)) {
			ComponentBindingsProvider ci = ComponentBindingsProvider.class
					.cast(bundleContext.getService(reference));
			cis.add(ci);
		}

		if (cis.size() != 0 && log.isDebugEnabled()) {
			log.debug(
					"Found {} Component Bindings Providers Services for resource type {}",
					cis.size(), resourceType);
		}

		return cis;
	}
594421
@Nullable
  public static String getClassPackageName (@Nullable final Object aObject)
  {
    return aObject == null ? null : getClassPackageName (aObject.getClass ());
  }
17578
public <T> T [] toArray(Class<T> componentClass) {
    final int size = size();
    final T[] array = (T[]) java.lang.reflect.Array.newInstance(componentClass, size);
    int i = 0;
    for (KTypeCursor<KType> c : this) {
      array[i++] = (T) c.value;
    }
    return array;
  }
219303
public ClassLoader findBundleClassLoader(String packageName, String versionRange)
    {
    	ClassLoader classLoader = this.getClassLoaderFromBundle(null, packageName, versionRange);

        if (classLoader == null) {
            Object resource = this.deployThisResource(packageName, versionRange, false);
            if (resource != null)
            	classLoader = this.getClassLoaderFromBundle(resource, packageName, versionRange);
        }

        return classLoader;    	
    }
322896
public static String getSourceByClass(Class<?> koanClass) {

        File file = new File(getKoanFileLocation(koanClass));
   		StringBuilder contents = new StringBuilder();
   		BufferedReader reader = null;

   		try {
   			reader = new BufferedReader(new FileReader(file));
   			String text = null;

   			while ((text = reader.readLine()) != null) {
   				contents.append(text).append(System.lineSeparator());
   			}
   		} catch (IOException e) {
   			e.printStackTrace();
   		} finally {
   			try {
   				if (reader != null) {
   					reader.close();
   				}
   			} catch (IOException e) {
   				e.printStackTrace();
   			}
   		}
   		return contents.toString();
   	}