Skip to content
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

Add DataType API for custom DataTypes #71

Open
bob7l opened this issue Jul 28, 2016 · 0 comments
Open

Add DataType API for custom DataTypes #71

bob7l opened this issue Jul 28, 2016 · 0 comments
Assignees

Comments

@bob7l
Copy link
Owner

bob7l commented Jul 28, 2016

My plan is to create new DataType API so plugins are able to register and utilize their own DataTypes without being forced to use one of the preexisting.

I'm also planning on changing the DataType Enum to an object. So instead of enums, the DataType's will be constants. We'll then grab all the constants via reflection and add them into the table. Enums are incredibly limiting and should only be used for really basic things like ID constants.

Basic rundown:
Register your DataType before it's used. The method may be DataType.addDataType(customDataType);

The DataType consists of a view variables such as the name, and the ID. You will NOT be able to define a custom constructor due to the fact that the constructor is used specifically by the HawkEye query and modifying the constructor will cause exceptions. So instead you'll define your DataEntry class (Whether it's custom, or one of HawkEye's).

I will MOST LIKELY expand the DataType's further to allow for better ingegration with the web interface. For instance, being able to define whether or not a DataType is serialized as a block, or item.

If a DataType is registered with a pre-existing ID, or too large of an ID, an exception will be thrown. Same goes for having the same name as a DataType.

Once the DataType is registered, it'll be entered into the MySQL. This is so the webinterface can see the new datatypes. It's also so if a custom datatype is registered once, and then not registered the next runtime, we can simply create a dummy DataType instead of returning a null DataType. Registering your DataType replaces the Dummy value.

@bob7l bob7l self-assigned this Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant