com.google.firebase.database.Exclude Java Examples

The following examples show how to use com.google.firebase.database.Exclude. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomClassMapper.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
private static boolean shouldIncludeSetter(Method method) {
  if (!method.getName().startsWith("set")) {
    return false;
  }
  // Exclude methods from Object.class
  if (method.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Static methods
  if (Modifier.isStatic(method.getModifiers())) {
    return false;
  }
  // Has a return type
  if (!method.getReturnType().equals(Void.TYPE)) {
    return false;
  }
  // Methods without exactly one parameters
  if (method.getParameterTypes().length != 1) {
    return false;
  }
  // Excluded methods
  if (method.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #2
Source File: CustomClassMapper.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
private static boolean shouldIncludeField(Field field) {
  // Exclude methods from Object.class
  if (field.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Non-public fields
  if (!Modifier.isPublic(field.getModifiers())) {
    return false;
  }
  // Static fields
  if (Modifier.isStatic(field.getModifiers())) {
    return false;
  }
  // Transient fields
  if (Modifier.isTransient(field.getModifiers())) {
    return false;
  }
  // Excluded fields
  if (field.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #3
Source File: CustomClassMapper.java    From firebase-admin-java with Apache License 2.0 6 votes vote down vote up
private static boolean shouldIncludeSetter(Method method) {
  if (!method.getName().startsWith("set")) {
    return false;
  }
  // Exclude methods from Object.class
  if (method.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Static methods
  if (Modifier.isStatic(method.getModifiers())) {
    return false;
  }
  // Has a return type
  if (!method.getReturnType().equals(Void.TYPE)) {
    return false;
  }
  // Methods without exactly one parameters
  if (method.getParameterTypes().length != 1) {
    return false;
  }
  // Excluded methods
  if (method.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #4
Source File: CustomClassMapper.java    From firebase-admin-java with Apache License 2.0 6 votes vote down vote up
private static boolean shouldIncludeField(Field field) {
  // Exclude methods from Object.class
  if (field.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Non-public fields
  if (!Modifier.isPublic(field.getModifiers())) {
    return false;
  }
  // Static fields
  if (Modifier.isStatic(field.getModifiers())) {
    return false;
  }
  // Transient fields
  if (Modifier.isTransient(field.getModifiers())) {
    return false;
  }
  // Excluded fields
  if (field.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #5
Source File: Message.java    From chat21-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
@Exclude
@Override
public String toString() {
    return "Message{" +
            "id='" + id + '\'' +
            ", sender='" + sender + '\'' +
            ", senderFullname='" + senderFullname + '\'' +
            ", recipient='" + recipient + '\'' +
            ", recipientFullname='" + recipientFullname + '\'' +
            ", text='" + text + '\'' +
            ", status=" + status +
            ", timestamp=" + timestamp +
            ", type='" + type + '\'' +
            ", channelType='" + channelType + '\'' +
            ", metadata=" + metadata +
            ", attributes=" + attributes +
            '}';
}
 
Example #6
Source File: UserInfo.java    From AvI with MIT License 6 votes vote down vote up
@Exclude
@Override
public Map<String, Object> toMap() {
    HashMap<String, Object> result = new HashMap<>();
    result.put("lastModifiedTime", ServerValue.TIMESTAMP);
    result.put("authId", authId);
    result.put("name", name);
    result.put("email", email);
    result.put("pictureUrl", pictureUrl);
    result.put("employment", employment);
    result.put("education", education);
    result.put("knowledgeableIn", knowledgeableIn);
    result.put("interests", interests);
    result.put("currentGoals", currentGoals);
    result.put("locationLat", locationLat);
    result.put("locationLon", locationLon);

    return result;
}
 
Example #7
Source File: ChatMessage.java    From AvI with MIT License 5 votes vote down vote up
@Exclude
@Override
public Map<String, Object> toMap() {
    HashMap<String, Object> result = new HashMap<>();
    result.put("sender", senderId);
    result.put("message", message);
    result.put("timestamp", ServerValue.TIMESTAMP);
    return result;
}
 
Example #8
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Exclude
public boolean isDirectChannel() {
    if (this.channelType==null || this.channelType.equals(Message.DIRECT_CHANNEL_TYPE)) {
        return true;
    } else {
        return false;
    }
}
 
Example #9
Source File: EntityTranslator.java    From Android-MVP-vs-MVVM-Samples with Apache License 2.0 5 votes vote down vote up
@Exclude
public static Map<String, Object> toMap(final CheckIn checkIn) {

    final Map<String, Object> result = new HashMap<>();

    result.put("email", checkIn.email);
    result.put("checkInMessage", checkIn.checkInMessage);
    result.put("timestamp", checkIn.timestamp == null ? ServerValue.TIMESTAMP : checkIn.timestamp);

    return result;
}
 
Example #10
Source File: Contact.java    From AvI with MIT License 5 votes vote down vote up
@Exclude
@Override
public Map<String, Object> toMap() {
    Map<String, Object> map = super.toMap();
    //if you need to add additional properties to Contact
    //make sure to add it here to map
    return map;
}
 
Example #11
Source File: UserInfo.java    From AvI with MIT License 5 votes vote down vote up
@Exclude
public Location getLocation(){
    Location retVal = new Location("Contact_Location");
    retVal.setLatitude(this.locationLat);
    retVal.setLongitude(this.locationLon);

    return retVal;
}
 
Example #12
Source File: Message.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Exclude
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException cnse) {
        return null;
    }
}
 
Example #13
Source File: Message.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@Exclude
public boolean equals(Object object) {
    if (object instanceof Message) {
        Message message = (Message) object;
        if (this.getId().equals(message.getId())) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
 
Example #14
Source File: Message.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Exclude
public boolean isGroupChannel() {
    if (this.channelType != null && this.channelType.equals(Message.GROUP_CHANNEL_TYPE)) {
        return true;
    } else {
        return false;
    }
}
 
Example #15
Source File: Message.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Exclude
public boolean isDirectChannel() {
    if (this.channelType == null || this.channelType.equals(Message.DIRECT_CHANNEL_TYPE)) {
        return true;
    } else {
        return false;
    }
}
 
Example #16
Source File: Post.java    From quickstart-android with Apache License 2.0 5 votes vote down vote up
@Exclude
public Map<String, Object> toMap() {
    HashMap<String, Object> result = new HashMap<>();
    result.put("uid", uid);
    result.put("author", author);
    result.put("title", title);
    result.put("body", body);
    result.put("starCount", starCount);
    result.put("stars", stars);

    return result;
}
 
Example #17
Source File: CustomClassMapper.java    From firebase-admin-java with Apache License 2.0 5 votes vote down vote up
private static boolean shouldIncludeGetter(Method method) {
  if (!method.getName().startsWith("get") && !method.getName().startsWith("is")) {
    return false;
  }
  // Exclude methods from Object.class
  if (method.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Non-public methods
  if (!Modifier.isPublic(method.getModifiers())) {
    return false;
  }
  // Static methods
  if (Modifier.isStatic(method.getModifiers())) {
    return false;
  }
  // No return type
  if (method.getReturnType().equals(Void.TYPE)) {
    return false;
  }
  // Non-zero parameters
  if (method.getParameterTypes().length != 0) {
    return false;
  }
  // Excluded methods
  if (method.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #18
Source File: History.java    From UberClone with MIT License 5 votes vote down vote up
@Exclude
public Map<String, Object> toMap(){
    HashMap<String, Object> result = new HashMap<>();
    result.put("distance", distance);
    result.put("endAddress", endAddress);
    result.put("time", time);
    result.put("locationEnd", locationEnd);
    result.put("locationStart", locationStart);
    result.put("name", name);
    result.put("startAddress", startAddress);
    result.put("total", total);
    result.put("tripDate", tripDate);

    return result;
}
 
Example #19
Source File: CustomClassMapper.java    From firebase-android-sdk with Apache License 2.0 5 votes vote down vote up
private static boolean shouldIncludeGetter(Method method) {
  if (!method.getName().startsWith("get") && !method.getName().startsWith("is")) {
    return false;
  }
  // Exclude methods from Object.class
  if (method.getDeclaringClass().equals(Object.class)) {
    return false;
  }
  // Non-public methods
  if (!Modifier.isPublic(method.getModifiers())) {
    return false;
  }
  // Static methods
  if (Modifier.isStatic(method.getModifiers())) {
    return false;
  }
  // No return type
  if (method.getReturnType().equals(Void.TYPE)) {
    return false;
  }
  // Non-zero parameters
  if (method.getParameterTypes().length != 0) {
    return false;
  }
  // Excluded methods
  if (method.isAnnotationPresent(Exclude.class)) {
    return false;
  }
  return true;
}
 
Example #20
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
@Exclude
public String getConversationId() {
    return conversationId;
}
 
Example #21
Source File: UserModel.java    From stockita-point-of-sale with MIT License 4 votes vote down vote up
@Exclude
public long getDateCreatedLong() {
    return (long)dateCreated.get(Constants.FIREBASE_PROPERTY_TIMESTAMP);
}
 
Example #22
Source File: Order.java    From Pharmacy-Android with GNU General Public License v3.0 4 votes vote down vote up
@Exclude
public Long getCreatedAtLong() {
    return createdAt;
}
 
Example #23
Source File: User.java    From Pharmacy-Android with GNU General Public License v3.0 4 votes vote down vote up
@Exclude
public Long getCreatedAtLong() {
    return createdAt;
}
 
Example #24
Source File: Contact.java    From AvI with MIT License 4 votes vote down vote up
@Exclude
public String getDistanceAsString(Location distanceTo){
    float distanceInKm = calculateDistance(distanceTo);
    return String.format("%.2f", distanceInKm) + " km";
}
 
Example #25
Source File: Contact.java    From AvI with MIT License 4 votes vote down vote up
@Exclude
public float calculateDistance(Location distanceTo){
    float distanceInMeters = this.getLocation().distanceTo(distanceTo);
    return distanceInMeters / 1000;
}
 
Example #26
Source File: AppsModel.java    From FastAccess with GNU General Public License v3.0 4 votes vote down vote up
@Exclude public ComponentName getComponentName() {
    return new ComponentName(packageName, activityInfoName);
}
 
Example #27
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
@Exclude
public Long getTimestampLong() {
    return timestamp;
}
 
Example #28
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
@Exclude
public void setConvers_with_fullname(String convers_with_fullname) {
    this.convers_with_fullname = convers_with_fullname;
}
 
Example #29
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
@Exclude
public String getConvers_with_fullname() {
    return convers_with_fullname;
}
 
Example #30
Source File: Conversation.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
@Exclude
public void setConvers_with(String convers_with) {
    this.convers_with = convers_with;
}