
com.workday.autoparse.json.parser.CompositeJsonObjectParserTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoparse-json Show documentation
Show all versions of autoparse-json Show documentation
A java library built specifically for Android that uses code generation to parse JSON into custom objects in your project.
/*
* Copyright 2016 Workday, Inc.
*
* This software is available under the MIT license.
* Please see the LICENSE.txt file in this project.
*/
package com.workday.autoparse.json.parser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* @author travis.westbrook
* @since 2016-01-07.
*/
public class CompositeJsonObjectParserTable implements JsonObjectParserTable {
private final Collection components;
public CompositeJsonObjectParserTable(Collection components) {
this.components = Collections.unmodifiableCollection(new ArrayList<>(components));
}
@Override
public JsonObjectParser> get(String name) {
for (JsonObjectParserTable parserMap : components) {
JsonObjectParser> parser = parserMap.get(name);
if (parser != null) {
return parser;
}
}
return null;
}
@Override
public Set keySet() {
Set keySet = new HashSet<>();
for (JsonObjectParserTable component : components) {
keySet.addAll(component.keySet());
}
return keySet;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy