GithubHelp home page GithubHelp logo

How to pass List as Extra? about blade HOT 5 CLOSED

aartikov avatar aartikov commented on May 18, 2024
How to pass List as Extra?

from blade.

Comments (5)

FrantisekGazo avatar FrantisekGazo commented on May 18, 2024 1

Supporting just List would be tricky - e.g. if you initialized it with a custom implementation then you would expect to have it there after deserialization.

I could try to add a mechanism for custom serialization&deserialization of objects.

from blade.

FrantisekGazo avatar FrantisekGazo commented on May 18, 2024

@aartikov v2.6.0-beta1 is out.

Now you can specify your own Bundler implementation for any object field.
e.g. @Extra(MyListBundler.class) List<String> mList;

Same goes for @Arg and @State.

You can try it and give me feedback 😉

from blade.

aartikov avatar aartikov commented on May 18, 2024

Nice! It works.

This is my ListBundler:

public class ListBundler implements Bundler<List> {
	private static final String KEY = "key";

	@Override
	@SuppressWarnings("unchecked")
	public void save(@Nullable List value, @NonNull Bundle state) {
		if(value == null || value instanceof Serializable) {
			state.putSerializable(KEY, (Serializable) value);
		} else {
			state.putSerializable(KEY, new ArrayList(value));
		}
	}

	@Nullable
	@Override
	public List restore(@NonNull Bundle state) {
		return (List)state.getSerializable(KEY);
	}
}

from blade.

FrantisekGazo avatar FrantisekGazo commented on May 18, 2024

Ok, I'll just change the package name to blade.Bundler and if I don't find anything else I'll release it as 2.6.0

from blade.

FrantisekGazo avatar FrantisekGazo commented on May 18, 2024

version 2.6.0 released

from blade.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.