本文整理了Java中java.lang.Package.isAnnotationPresent()
方法的一些代码示例,展示了Package.isAnnotationPresent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Package.isAnnotationPresent()
方法的具体详情如下:
包路径:java.lang.Package
类名称:Package
方法名:isAnnotationPresent
[英]Indicates whether the specified annotation is present.
[中]指示指定的批注是否存在。
代码示例来源:origin: spring-projects/spring-framework
if (outputClassPackage != null && outputClassPackage.isAnnotationPresent(XmlSchema.class)) {
XmlSchema annotation = outputClassPackage.getAnnotation(XmlSchema.class);
namespaceUri = annotation.namespace();
代码示例来源:origin: org.springframework/spring-web
if (outputClassPackage != null && outputClassPackage.isAnnotationPresent(XmlSchema.class)) {
XmlSchema annotation = outputClassPackage.getAnnotation(XmlSchema.class);
namespaceUri = annotation.namespace();
代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-common
private static boolean packageHasAnnotation(Class<? extends Annotation> annotationClass, Package resourcePackage) {
return resourcePackage != null && resourcePackage.isAnnotationPresent(annotationClass);
}
代码示例来源:origin: resteasy/Resteasy
private static LinkELProvider findLinkELProvider(Method m){
if(m.isAnnotationPresent(LinkELProvider.class))
return m.getAnnotation(LinkELProvider.class);
Class<?> c = m.getDeclaringClass();
if(c.isAnnotationPresent(LinkELProvider.class))
return c.getAnnotation(LinkELProvider.class);
Package p = c.getPackage();
if(p != null && p.isAnnotationPresent(LinkELProvider.class))
return p.getAnnotation(LinkELProvider.class);
return null;
}
代码示例来源:origin: weld/core
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: org.jboss.weld.se/weld-se
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: weld/core
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: weld/core
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: org.jboss.weld.se/weld-se-shaded
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded
private static boolean isPackageVetoed(Package pkg) {
return pkg != null && pkg.isAnnotationPresent(Vetoed.class);
}
代码示例来源:origin: org.jboss.seam/jboss-seam
private boolean isAutoCreateAnnotationPresent()
{
if (componentClass.isAnnotationPresent(AutoCreate.class)) {
return true;
}
Package pkg = componentClass.getPackage();
return pkg!=null && pkg.isAnnotationPresent(AutoCreate.class);
}
代码示例来源:origin: net.sf.ipsedixit/ipsedixit
private boolean isAnnotated() {
return this.getClass().isAnnotationPresent(Ipsedixit.class) ||
this.getClass().getPackage().isAnnotationPresent(Ipsedixit.class);
}
}
代码示例来源:origin: net.sf.ipsedixit/ipsedixit
private boolean isAnnotated() {
return this.getClass().isAnnotationPresent(Ipsedixit.class) ||
this.getClass().getPackage().isAnnotationPresent(Ipsedixit.class);
}
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object
public ClassLoaderPackages(ClassLoader parent) {
super(parent);
namespacePackages = new HashSet<Package>();
for (Package pkg : getPackages()) {
if (pkg.isAnnotationPresent(Iri.class)) {
namespacePackages.add(pkg);
}
}
}
代码示例来源:origin: anno4j/anno4j
public ClassLoaderPackages(ClassLoader parent) {
super(parent);
namespacePackages = new HashSet<Package>();
for (Package pkg : getPackages()) {
if (pkg.isAnnotationPresent(Iri.class)) {
namespacePackages.add(pkg);
}
}
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
private static void inspectPackage(Package p, List<Pair<Reference, TreeSet<Object>>> refs, Map<Reference, TreeSet<Object>> map) {
if(p.isAnnotationPresent(Reference.class)) {
Reference ref = p.getAnnotation(Reference.class);
addReference(p, ref, refs, map);
}
}
代码示例来源:origin: org.openrdf.elmo/elmo-codegen
private String findNamespace(Class<?> beanClass) {
String packageName = getPackageName(beanClass);
if (namespaces.containsKey(packageName))
return namespaces.get(packageName);
Package pkg = beanClass.getPackage();
if (pkg != null && pkg.isAnnotationPresent(rdf.class)) {
String name = pkg.getAnnotation(rdf.class).value()[0];
return getNamespace(name);
}
return null;
}
代码示例来源:origin: openimaj/openimaj
private static void processPackage(Class<?> clz) {
Package base = clz.getPackage();
while (base != null) {
if (base.isAnnotationPresent(Reference.class))
addReference(base.getAnnotation(Reference.class));
if (base.isAnnotationPresent(References.class))
for (final Reference r : base.getAnnotation(References.class).references())
addReference(r);
final String name = base.getName();
final int dot = name.lastIndexOf(".");
if (dot < 0)
break;
base = Package.getPackage(name.substring(0, dot));
}
}
代码示例来源:origin: anno4j/anno4j
public JavaNameResolver(ClassLoader cl) {
this.cl = new ClassLoaderPackages(cl);
for (Package pkg : this.cl.getNamespacePackages()) {
if (pkg.isAnnotationPresent(Prefix.class)) {
String prefix = pkg.getAnnotation(Prefix.class).value();
String ns = pkg.getAnnotation(Iri.class).value();
bindPrefixToNamespace(prefix, ns);
}
}
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object
public JavaNameResolver(ClassLoader cl) {
this.cl = new ClassLoaderPackages(cl);
for (Package pkg : this.cl.getNamespacePackages()) {
if (pkg.isAnnotationPresent(Prefix.class)) {
String prefix = pkg.getAnnotation(Prefix.class).value();
String ns = pkg.getAnnotation(Iri.class).value();
bindPrefixToNamespace(prefix, ns);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!