com.enonic.xp.extractor.ExtractedData Maven / Gradle / Ivy
package com.enonic.xp.extractor;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class ExtractedData
{
private final Map> metadata;
private final String text;
private final String imageOrientation;
private ExtractedData( final Builder builder )
{
metadata = builder.metadata;
text = builder.text;
imageOrientation = builder.imageOrientation;
}
public String getImageOrientation()
{
return imageOrientation;
}
public static Builder create()
{
return new Builder();
}
public String get( final String name )
{
final List values = metadata.get( name );
if ( values == null )
{
return null;
}
if ( !values.iterator().hasNext() )
{
return null;
}
return values.iterator().next();
}
public Set names()
{
return this.metadata.keySet();
}
public Map> getMetadata()
{
return metadata;
}
public String getText()
{
return text;
}
public static final class Builder
{
private Map> metadata;
private String text;
private String imageOrientation;
private Builder()
{
}
public Builder metadata( final Map> val )
{
metadata = val;
return this;
}
public Builder text( final String val )
{
text = val;
return this;
}
public Builder imageOrientation( final String val )
{
imageOrientation = val;
return this;
}
public ExtractedData build()
{
return new ExtractedData( this );
}
}
}