-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properties in auto generated introspection data #130
Comments
Sounds like a good idea. Only thing I did not like about it, is the way "type" is specified. You expect that the developer adds the DBus type string in "type" field.
I would be more happy with a way to specify the type as classes (e.g. String.class), which will probably not work with complex types, especially generics (how to represent Map<K, V> ?). I already thought about an extra interface providing a method where all properties should be returned. Also please note: I will change the libraries license to MIT at the end of the month. |
Yes, you're right, type as a String can cause mess and potential typos. By default, we can treat maps and lists as follows:
It would be enought for most of users. Regarding to the TypeReference you mentioned, we can provide full information about generic type by explicitly declaring the "TypeRef" interface: public interface TypeRef<T> {
} And use this interface to define the complex type: @DBusInterfaceName("com.example.Bar")
@DBusProperty(name = "SomeMap", type = ComplexTypeWithMapAndList.class, access = Access.READ)
public interface Bar extends DBusInterface {
// user wants very, very much to provide detailed type information, so he declared such an interface
interface ComplexTypeWithMapAndList extends TypeRef<Map<String, List<String>>> {
}
} It will work similar to the Jackson TypeReference |
👍 |
[#130] DBusProperty annotation added
Thank you for accepting the PR, This issue can be closed now. Soon I will prepare a PR with the InterfaceCodeGenerator update. |
Hello,
I like to use this library at work, so I'm writing with a proposal to extend the Introspection functionality.
Currently, automatically generated introspection data doesn't provide information about properties in the interfaces.
This is obvious because property names/types/access for interfaces are not declared anywhere.
The property information can be helpful during development, especially when using tools like d-feet.
Current state
Let's suppose that we have two interfaces:
And we have one object implementing interfaces:
The introspection data generated for exported ExampleObject object:
DBusProperty annotation proposal
My idea is to create annotation which allows to describe properties in the interface:
With this annotation we could append information about the interface properties:
At this point, the introspection generator can discover the properties used in the interface and add them to the response body.
The data from introspection will look like this:
With this change, programs like d-feet will be able to fully detect and correctly display properties in interfaces.
I hope for opinions on this solution, if it's acceptable I could prepare a PR with changes
The text was updated successfully, but these errors were encountered: