public List<WadlSaasResource> getResources() {
if (resources == null) {
resources = new ArrayList<WadlSaasResource>();
try {
for (org.netbeans.modules.websvc.saas.model.wadl.Resources wadlResources :
getWadlModel().getResources())
{
for (Resource r : wadlResources.getResource()) {
resources.add(new WadlSaasResource(this, null, r));
}
}
}
catch (Exception ex) {
Exceptions.printStackTrace(ex);
return Collections.<WadlSaasResource>emptyList();
}
}
return new ArrayList<WadlSaasResource>(resources);
}
java类javax.annotation.Resources的实例源码
WadlSaas.java 文件源码
项目:incubator-netbeans
阅读 27
收藏 0
点赞 0
评论 0
ClasspathScannerTest.java 文件源码
项目:dolphin-platform
阅读 32
收藏 0
点赞 0
评论 0
@Test
public void testScanOtherPackage() {
//There can't be a class that is annotated with Inject
final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN);
Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
assertNotNull(classes);
assertEquals(classes.size(), 0);
classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
assertNotNull(classes);
assertEquals(classes.size(), 0);
classes = scanner.getTypesAnnotatedWith(Documented.class);
assertNotNull(classes);
assertEquals(classes.size(), 1);
assertTrue(classes.contains(DocumentAnnotatedClass.class));
}
WadlSaas.java 文件源码
项目:incubator-netbeans
阅读 30
收藏 0
点赞 0
评论 0
public String getBaseURL() {
try {
List<org.netbeans.modules.websvc.saas.model.wadl.Resources> wadlResources =
getWadlModel().getResources();
if ( wadlResources.size() >0 ){
return wadlResources.get(0).getBase();
}
return null;
} catch (IOException ioe) {
// should not happen at this point
return NbBundle.getMessage(WadlSaas.class, "LBL_BAD_WADL");
}
}
ClasspathScannerTest.java 文件源码
项目:dolphin-platform
阅读 45
收藏 0
点赞 0
评论 0
@Test
public void testSimpleScan() {
//There can't be a class that is annotated with Inject
final DefaultClasspathScanner scanner = new DefaultClasspathScanner();
Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
assertNotNull(classes);
assertEquals(classes.size(), 0);
classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
assertNotNull(classes);
assertEquals(classes.size(), 1);
assertTrue(classes.contains(AnnotatedClassForClasspathScan.class));
}
BatchGUI.java 文件源码
项目:netarchivesuite-svngit-migration
阅读 33
收藏 0
点赞 0
评论 0
/**
* Retrieves the HTML code for the description of the class.
* The description of the class is given in the resource annotation which
* has the type of the given class.
*
* <br/>
* E.g.
* <br/>
* @Resource(description="Batchjob for finding URLs which matches a given"
* + " regular expression and has a mimetype which matches another"
* + " regular expression.",
* type=dk.netarkivet.common.utils.batch.UrlSearch.class)}
*
* <br/><br/>
* Which gives the UrlSearch batchjob the following description:
* <br/><br/>
* Description: Batchjob for finding URLs which matches a given regular
* expression and has a mimetype which matches another regular expression.
* <br/><br/>
*
* @param c The class to be described.
* @param locale The locale language package.
* @return The HTML code describing the class.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static String getClassDescription(Class c, Locale locale) {
// retrieve the resources.
Resources r = (Resources) c.getAnnotation(Resources.class);
if(r == null) {
return "<br/>\n";
}
// Find and return the description of this class (if any).
for(Resource resource : r.value()) {
if(resource.type().getName().equals(c.getName())) {
return I18N.getString(locale, "batchpage;Description",
new Object[]{}) + ": "+ resource.description()
+ "<br/><br/>\n";
}
}
// no description found, then return empty string.
return "<br/>\n";
}
ResourcesTest.java 文件源码
项目:cn1
阅读 37
收藏 0
点赞 0
评论 0
public void testResources() {
assertTrue(Resources.class.isAnnotation());
}