本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getAnnotation()
方法的一些代码示例,展示了MetaClass.getAnnotation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getAnnotation()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getAnnotation
暂无
代码示例来源:origin: errai/errai
private boolean isNativeJSType(final MetaClass type) {
final JsType anno = type.getAnnotation(JsType.class);
return type.getAnnotation(JsType.class) != null && anno.isNative();
}
代码示例来源:origin: errai/errai
private Set<Property> getProperties(final MetaClass type) {
final Set<Property> properties = new HashSet<>();
final Property declaredProperty = type.getAnnotation(Property.class);
final Properties declaredProperties = type.getAnnotation(Properties.class);
if (declaredProperty != null) {
properties.add(declaredProperty);
}
if (declaredProperties != null) {
properties.addAll(Arrays.asList(declaredProperties.value()));
}
return properties;
}
代码示例来源:origin: org.jboss.errai/errai-ui
private Set<Property> getProperties(final MetaClass type) {
final Set<Property> properties = new HashSet<>();
final Property declaredProperty = type.getAnnotation(Property.class);
final Properties declaredProperties = type.getAnnotation(Properties.class);
if (declaredProperty != null) {
properties.add(declaredProperty);
}
if (declaredProperties != null) {
properties.addAll(Arrays.asList(declaredProperties.value()));
}
return properties;
}
代码示例来源:origin: org.jboss.errai/errai-ui
private static List<String> gwtElementTags(MetaClass type) {
return Optional.ofNullable(type.getAnnotation(TagName.class))
.map(a -> Arrays.asList(a.value()))
.orElse(emptyList());
}
代码示例来源:origin: errai/errai
private String getPageURL(MetaClass pageClass, String pageName) {
Page pageAnnotation = pageClass.getAnnotation(Page.class);
String path = pageAnnotation.path();
if (path.equals("")) {
return pageName;
}
return path;
}
代码示例来源:origin: org.jboss.errai/errai-navigation
private String getPageURL(MetaClass pageClass, String pageName) {
Page pageAnnotation = pageClass.getAnnotation(Page.class);
String path = pageAnnotation.path();
if (path.equals("")) {
return pageName;
}
return path;
}
代码示例来源:origin: errai/errai
private static List<String> gwtElementTags(MetaClass type) {
return Optional.ofNullable(type.getAnnotation(TagName.class))
.map(a -> Arrays.asList(a.value()))
.orElse(emptyList());
}
代码示例来源:origin: org.jboss.errai/errai-jaxrs-client
public JaxrsProxyGenerator(MetaClass remote, final GeneratorContext context,
final InterceptorProvider interceptorProvider, Multimap<MetaClass, MetaClass> exceptionMappers) {
this.remote = remote;
this.context = context;
this.exceptionMappers = exceptionMappers;
this.rootResourcePath = remote.getAnnotation(Path.class).value();
this.headers = JaxrsHeaders.fromClass(remote);
this.interceptorProvider = interceptorProvider;
}
代码示例来源:origin: org.jboss.errai/errai-ui
private static Collection<String> customElementTags(final MetaClass type) {
final Element elementAnnotation = type.getAnnotation(Element.class);
if (elementAnnotation == null) {
return Collections.emptyList();
}
final JsType jsTypeAnnotation = type.getAnnotation(JsType.class);
if (jsTypeAnnotation == null || !jsTypeAnnotation.isNative()) {
final String element = Element.class.getSimpleName();
final String jsType = JsType.class.getSimpleName();
throw new RuntimeException(element + " is only valid on native " + jsType + "s.");
}
return Arrays.asList(elementAnnotation.value());
}
代码示例来源:origin: org.jboss.errai/errai-ui
private List<String> getClassNames(final MetaClass type) {
return Optional.ofNullable(type.getAnnotation(ClassNames.class))
.map(a -> Arrays.asList(a.value()))
.orElse(emptyList());
}
}
代码示例来源:origin: errai/errai
private boolean isNativeJsType(final MetaClass eventType) {
return Optional
.ofNullable(eventType.getAnnotation(JsType.class)).filter(anno -> anno.isNative()).isPresent();
}
代码示例来源:origin: errai/errai
private static boolean hasNativeJsTypeAnnotation(final MetaClass type) {
final JsType anno = type.getAnnotation(JsType.class);
return anno != null && anno.isNative();
}
代码示例来源:origin: errai/errai
private String getBeanName(final Injectable injectable) {
final Named named = injectable.getInjectedType().getAnnotation(Named.class);
return (named != null) ? named.value() : null;
}
代码示例来源:origin: errai/errai
private List<String> getClassNames(final MetaClass type) {
return Optional.ofNullable(type.getAnnotation(ClassNames.class))
.map(a -> Arrays.asList(a.value()))
.orElse(emptyList());
}
}
代码示例来源:origin: org.jboss.errai/errai-ui
private String getPathRoot(final MetaClass bundleClass, final URL resource) {
final String fullPath = resource.getPath();
final String resourcePath = bundleClass.getAnnotation(Bundle.class).value();
final String protocol = resource.getProtocol();
final String relativePath;
if (resourcePath.startsWith("/"))
relativePath = resourcePath;
else
// Do NOT use File.separatorChar here: Url.getPath() always uses forward-slashes
relativePath = bundleClass.getPackageName().replace('.', '/');
final String pathRoot = fullPath.substring(0, fullPath.indexOf(relativePath));
return protocol + ":" + pathRoot;
}
代码示例来源:origin: errai/errai
private void setFeatureInterceptors(final Collection<MetaClass> featureInterceptors) {
for (final MetaClass featureInterceptor : featureInterceptors) {
final Class<? extends Annotation>[] annotations =
featureInterceptor.getAnnotation(FeatureInterceptor.class).value();
for (int i = 0; i < annotations.length; i++) {
this.featureInterceptors.put(annotations[i], featureInterceptor.asClass());
}
}
}
代码示例来源:origin: errai/errai
private void setStandaloneInterceptors(final Collection<MetaClass> standaloneInterceptors) {
for (final MetaClass interceptorClass : standaloneInterceptors) {
final InterceptsRemoteCall interceptor = interceptorClass.getAnnotation(InterceptsRemoteCall.class);
final Class<?>[] intercepts = interceptor.value();
for (final Class<?> intercept : intercepts) {
this.standaloneInterceptors.put(intercept, interceptorClass.asClass());
}
}
}
代码示例来源:origin: errai/errai
private Stream<MetaClass> findJsTypeIfaces(final MetaClass type) {
return stream(type.getInterfaces())
.flatMap(iface -> stream(iface.getInterfaces()))
.distinct()
.filter(iface -> !iface.getFullyQualifiedName().startsWith("java.util"))
.filter(iface -> iface.isAnnotationPresent(JsType.class) && !iface.getAnnotation(JsType.class).isNative());
}
代码示例来源:origin: errai/errai
private Class<?> getAsyncFragmentId(final Injectable injectable) {
final LoadAsync loadAsync = injectable.getInjectedType().getAnnotation(LoadAsync.class);
if (loadAsync == null) {
return LoadAsync.NO_FRAGMENT.class;
} else {
return loadAsync.value();
}
}
代码示例来源:origin: errai/errai
private boolean isEnabledByProperty(final MetaClass type) {
final EnabledByProperty anno = type.getAnnotation(EnabledByProperty.class);
final boolean propValue = getPropertyValue(anno.value(),
anno.matchValue(),
anno.matchByDefault(),
anno.caseSensitive());
final boolean negated = anno.negated();
return propValue ^ negated;
}
内容来源于网络,如有侵权,请联系作者删除!