53 if (DBusInterface.class.equals(c))
return new HashMap<MethodTuple, Method>();
54 Map<MethodTuple, Method> m =
new HashMap<MethodTuple, Method>();
55 for (Class i : c.getInterfaces())
56 if (DBusInterface.class.equals(i)) {
58 if (null != c.getAnnotation(DBusInterfaceName.class)) {
59 String name = ((DBusInterfaceName) c.getAnnotation(DBusInterfaceName.class)).value();
61 DBusSignal.addInterfaceMap(c.getName(), name);
65 if (c.getName().equals(c.getSimpleName()))
66 throw new DBusException(getString(
"interfaceNotAllowedOutsidePackage"));
67 if (c.getName().length() > DBusConnection.MAX_NAME_LENGTH)
68 throw new DBusException(getString(
"introspectInterfaceExceedCharacters") + c.getName());
70 introspectiondata +=
" <interface name=\"" + AbstractConnection.dollar_pattern.matcher(c.getName()).replaceAll(
".") +
"\">\n";
73 for (Method meth : c.getDeclaredMethods())
74 if (Modifier.isPublic(meth.getModifiers())) {
77 if (meth.isAnnotationPresent(DBusMemberName.class))
78 name = meth.getAnnotation(DBusMemberName.class).value();
80 name = meth.getName();
81 if (name.length() > DBusConnection.MAX_NAME_LENGTH)
82 throw new DBusException(getString(
"introspectMethodExceedCharacters") + name);
85 for (Class ex : meth.getExceptionTypes())
86 if (DBusExecutionException.class.isAssignableFrom(ex))
88 " <annotation name=\"org.freedesktop.DBus.Method.Error\" value=\"" + AbstractConnection.dollar_pattern.matcher(ex.getName()).replaceAll(
".") +
"\" />\n";
89 for (Type pt : meth.getGenericParameterTypes())
90 for (String s : Marshalling.getDBusType(pt)) {
94 if (!Void.TYPE.equals(meth.getGenericReturnType())) {
95 if (Tuple.class.isAssignableFrom((Class) meth.getReturnType())) {
96 ParameterizedType tc = (ParameterizedType) meth.getGenericReturnType();
97 Type[] ts = tc.getActualTypeArguments();
101 for (String s : Marshalling.getDBusType(t))
103 }
else if (Object[].
class.equals(meth.getGenericReturnType())) {
104 throw new DBusException(getString(
"cannotIntrospectReturnType"));
106 for (String s : Marshalling.getDBusType(meth.getGenericReturnType()))
110 m.put(
new MethodTuple(name, ms), meth);
112 for (Class sig : c.getDeclaredClasses())
113 if (DBusSignal.class.isAssignableFrom(sig)) {
115 if (sig.isAnnotationPresent(DBusMemberName.class)) {
116 name = ((DBusMemberName) sig.getAnnotation(DBusMemberName.class)).value();
117 DBusSignal.addSignalMap(sig.getSimpleName(), name);
119 name = sig.getSimpleName();
120 if (name.length() > DBusConnection.MAX_NAME_LENGTH)
121 throw new DBusException(getString(
"introspectSignalExceedCharacters") + name);
123 Constructor con = sig.getConstructors()[0];
124 Type[] ts = con.getGenericParameterTypes();
125 for (
int j = 1; j < ts.length; j++)
126 for (String s : Marshalling.getDBusType(ts[j]))
String getAnnotations(AnnotatedElement c)
Definition: ExportedObject.java:33
Map< MethodTuple, Method > getExportedMethods(Class c)
Definition: ExportedObject.java:52
String introspectiondata
Definition: ExportedObject.java:142