Search in sources :

Example 6 with Typed

use of org.traccar.model.Typed in project traccar by traccar.

the class NotificationManager method getAllNotificationTypes.

public Set<Typed> getAllNotificationTypes() {
    Set<Typed> types = new HashSet<>();
    Field[] fields = Event.class.getDeclaredFields();
    for (Field field : fields) {
        if (Modifier.isStatic(field.getModifiers()) && field.getName().startsWith("TYPE_")) {
            try {
                types.add(new Typed(field.get(null).toString()));
            } catch (IllegalArgumentException | IllegalAccessException error) {
                Log.warning(error);
            }
        }
    }
    return types;
}
Also used : Field(java.lang.reflect.Field) Typed(org.traccar.model.Typed) HashSet(java.util.HashSet)

Example 7 with Typed

use of org.traccar.model.Typed in project traccar by tananaev.

the class CommandsManager method getAllCommandTypes.

public Collection<Typed> getAllCommandTypes() {
    List<Typed> result = new ArrayList<>();
    Field[] fields = Command.class.getDeclaredFields();
    for (Field field : fields) {
        if (Modifier.isStatic(field.getModifiers()) && field.getName().startsWith("TYPE_")) {
            try {
                result.add(new Typed(field.get(null).toString()));
            } catch (IllegalArgumentException | IllegalAccessException error) {
                LOGGER.warn("Get command types error", error);
            }
        }
    }
    return result;
}
Also used : Field(java.lang.reflect.Field) Typed(org.traccar.model.Typed) ArrayList(java.util.ArrayList)

Aggregations

Typed (org.traccar.model.Typed)7 ArrayList (java.util.ArrayList)5 Field (java.lang.reflect.Field)4 BaseProtocol (org.traccar.BaseProtocol)3 HashSet (java.util.HashSet)2 Position (org.traccar.model.Position)2