use of org.infinispan.protostream.annotations.ProtoName in project protostream by infinispan.
the class ProtoEnumTypeMetadata method getProtoName.
private static String getProtoName(XClass annotatedEnumClass, XClass enumClass) {
ProtoName annotation = annotatedEnumClass.getAnnotation(ProtoName.class);
ProtoEnum protoEnumAnnotation = annotatedEnumClass.getAnnotation(ProtoEnum.class);
if (annotation != null) {
if (protoEnumAnnotation != null) {
throw new ProtoSchemaBuilderException("@ProtoEnum annotation cannot be used together with @ProtoName: " + annotatedEnumClass.getName());
}
return annotation.value().isEmpty() ? enumClass.getSimpleName() : annotation.value();
}
return protoEnumAnnotation == null || protoEnumAnnotation.name().isEmpty() ? enumClass.getSimpleName() : protoEnumAnnotation.name();
}
use of org.infinispan.protostream.annotations.ProtoName in project protostream by infinispan.
the class ProtoMessageTypeMetadata method getProtoName.
private static String getProtoName(XClass annotatedClass, XClass javaClass) {
ProtoName annotation = annotatedClass.getAnnotation(ProtoName.class);
ProtoMessage protoMessageAnnotation = annotatedClass.getAnnotation(ProtoMessage.class);
if (annotation != null) {
if (protoMessageAnnotation != null) {
throw new ProtoSchemaBuilderException("@ProtoMessage annotation cannot be used together with @ProtoName: " + annotatedClass.getName());
}
return annotation.value().isEmpty() ? javaClass.getSimpleName() : annotation.value();
}
return protoMessageAnnotation == null || protoMessageAnnotation.name().isEmpty() ? javaClass.getSimpleName() : protoMessageAnnotation.name();
}
Aggregations