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 Event event(String type) { return new Event(type); }
public static Event event(EventType type) { return new Event(type); }
public static Entity entity(EntityType type, String id) { return new Entity(type, id); }
public static Entity entity(String type, String id) { return entity(new EntityType(type), id); }
public static Comment comment(String comment) { return new Comment(comment);}
public static EntityRelation rel() { return new EntityRelation(); }
public static EntityRole role(EntityRoleType role, Entity entity) { return new EntityRole(role, entity); }
public static CommentEntityRole role(CommentEntityRoleType role, Entity entity) { return new CommentEntityRole(role, entity); }
// Aspects
public static CommerceAspect commerce(CommerceAspectItem... items) { return new CommerceAspect().items(items); }
public static CommerceAspectItem item() { return new CommerceAspectItem(); }
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()); }
public static TagsAspect tags(String... tags) { return new TagsAspect(tags); }
public static PageviewAspect pageview(String url) { return new PageviewAspect(url); }
public static LocaleAspect locale() { return new LocaleAspect(); }
public static InventoryAspect inventory() { return new InventoryAspect(); }
public static MessagingAspect messaging() { return new MessagingAspect(); }
public static AddressAspect address(String streetAndNumber) { return new AddressAspect().streetAndNumber(streetAndNumber); }
public static AttachmentAspect attachment(String url) { return new AttachmentAspect(url); }
// 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