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

com.activitystream.Sugar Maven / Gradle / Ivy

package com.activitystream;

import com.activitystream.aspects.*;
import com.activitystream.helpers.MapCreator;

import java.util.Map;

public class Sugar {

    // Core concepts

    public static Entity entity(EntityType type, String id) { return new Entity().id(type, id); }

    public static Entity entity(String type, String id) { return entity(new EntityType(type), id); }

    public static EntityRelation rel() { return new EntityRelation(); }

    public static EntityRole role(EntityRoleType role, Entity entity) { return new EntityRole(role, entity); }

    public static Event event(String type) { return new Event(type); }

    public static Event event(EventType type) { return new Event(type); }

    // Aspects

    public static ECommerceAspect eCommerce(ECommerceAspectItem... items) { return new ECommerceAspect().items(items); }

    public static ECommerceAspectItem item() { return new ECommerceAspectItem(); }

    public static ClassificationAspect classification() { return new ClassificationAspect(); }

    public static TimedAspect timed() { return new TimedAspect(); }

    public static ClientIPAddressAspect clientIp(String ip) { return new ClientIPAddressAspect().clientIp(ip); }

    public static ClientDeviceAspect clientDevice(String agent) { return new ClientDeviceAspect().clientDevice(agent); }

    public static LocationAspect location(String latlong) { return new LocationAspect(latlong); }

    public static PresentationAspect presentation() { return new PresentationAspect(); }

    public static DimensionsAspect dimensions(Map dimensions) { return new DimensionsAspect(dimensions); }

    public static DimensionsAspect dimensions(MapCreator dimensions) { return dimensions(dimensions.map()); }

    public static MetricsAspect metrics(Map metrics) { return new MetricsAspect(metrics); }

    public static MetricsAspect metrics(MapCreator metrics) { return metrics(metrics.map()); }

    // helpers to create strongly typed maps

    public static MapCreator m() { return new MapCreator<>(); }

    public static MapCreator mstr() { return new MapCreator<>(); }

    public static MapCreator mdbl() { return new MapCreator<>(); }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy