All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.alexmojaki.caseclasses.CollectionBuilder Maven / Gradle / Ivy

The newest version!
package com.github.alexmojaki.caseclasses;

import java.util.Collection;

class CollectionBuilder extends AbstractResultBuilder {

    private Collection collection;
    private Class type;

    @SuppressWarnings("unchecked")
    static , E> void addValues(CaseClass obj, T collection, Class type) {
        CollectionBuilder builder = new CollectionBuilder();
        builder.collection = collection;
        builder.type = type;
        obj.buildResult(builder);
    }

    static  void addValues(CaseClass obj, T collection) {
        addValues(obj, collection, Object.class);
    }

    @Override
    public void simpleAdd(String name, Object value) {
        collection.add(type.cast(value));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy