Android Open Source - NFCAndroid Record Type






From Project

Back to project page NFCAndroid.

License

The source code is released under:

Copyright (c) 2012, Wireless Sensor Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following ...

If you think the Android project NFCAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gototags.nfc.records;
//  w  w w . java2 s .  c om
import java.lang.reflect.Type;

public class RecordType implements Comparable<RecordType> {
  private String name;
  private Type type;
  private Integer priority; 
  private NdefRecordParser ndefRecordParser;

  public RecordType(String name, Type type, Integer priority, NdefRecordParser ndefRecordParser) {
    this.setName(name);
    this.setType(type);
    this.setPriority(priority);
    this.setNdefRecordParser(ndefRecordParser);
  }
  
  public String getName() {
    return this.name;
  }

  private void setName(String name) {
    this.name = name;
  }
  
  public Type getType() {
    return this.type;
  }

  private void setType(Type type) {
    this.type = type;
  }

  public Integer getPriority() {
    return this.priority;
  }

  private void setPriority(Integer priority) {
    this.priority = priority;
  }

  public NdefRecordParser getNdefRecordParser() {
    return this.ndefRecordParser;
  }

  private void setNdefRecordParser(NdefRecordParser ndefRecordParser) {
    this.ndefRecordParser = ndefRecordParser;
  }

  public int compareTo(RecordType recordType) {
    return -1 * this.getPriority().compareTo(recordType.getPriority());
  }
  
  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    else if (!(this instanceof RecordType))
      return false;
    else {
      RecordType recordType = (RecordType)obj;
      
      return 
        this.getName().equals(recordType.getName()) &&  
        this.getType().equals(recordType.getType()) &&
        this.getPriority().equals(recordType.getPriority()) &&
        this.getNdefRecordParser().equals(recordType.getNdefRecordParser());
    }
  }
  
  @Override
  public int hashCode() {
    return this.getType().hashCode();
  }
  
  @Override
  public String toString() {
    return this.getName(); 
  }
}




Java Source Code List

com.gototags.nfc.Helper.java
com.gototags.nfc.NfcTag.java
com.gototags.nfc.app.BaseActivity.java
com.gototags.nfc.app.MainActivity.java
com.gototags.nfc.ndef.ParsedNdefRecord.java
com.gototags.nfc.ndef.TextNdefRecord.java
com.gototags.nfc.ndef.UriNdefRecord.java
com.gototags.nfc.records.NdefRecordParser.java
com.gototags.nfc.records.PhoneRecord.java
com.gototags.nfc.records.RecordType.java
com.gototags.nfc.records.Record.java
com.gototags.nfc.records.TextRecord.java
com.gototags.nfc.records.WebsiteRecord.java