本文整理汇总了Java中org.xbill.DNS.Type.value方法的典型用法代码示例。如果您正苦于以下问题:Java Type.value方法的具体用法?Java Type.value怎么用?Java Type.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xbill.DNS.Type
的用法示例。
在下文中一共展示了Type.value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
String dnsName = exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class);
ObjectHelper.notEmpty(dnsName, "Header " + DnsConstants.DNS_NAME);
Object type = exchange.getIn().getHeader(DnsConstants.DNS_TYPE);
Integer dnsType = null;
if (type != null) {
dnsType = Type.value(String.valueOf(type));
}
Object dclass = exchange.getIn().getHeader(DnsConstants.DNS_CLASS);
Integer dnsClass = null;
if (dclass != null) {
dnsClass = DClass.value(String.valueOf(dclass));
}
Lookup lookup = (dnsClass == null)
? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
: new Lookup(dnsName, dnsType, dnsClass);
lookup.run();
if (lookup.getAnswers() != null) {
exchange.getIn().setBody(lookup.getAnswers());
} else {
throw new CamelException(lookup.getErrorString());
}
}
示例2: process
import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
String server = exchange.getIn().getHeader(DnsConstants.DNS_SERVER, String.class);
SimpleResolver resolver = new SimpleResolver(server);
int type = Type.value(exchange.getIn().getHeader(DnsConstants.DNS_TYPE, String.class));
if (type == -1) {
// default: if unparsable value given, use A.
type = Type.A;
}
String dclassValue = exchange.getIn().getHeader(DnsConstants.DNS_CLASS, String.class);
if (dclassValue == null) {
dclassValue = "";
}
int dclass = DClass.value(dclassValue);
if (dclass == -1) {
// by default, value is IN.
dclass = DClass.IN;
}
Name name = Name.fromString(exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class), Name.root);
Record rec = Record.newRecord(name, type, dclass);
Message query = Message.newQuery(rec);
Message response = resolver.send(query);
exchange.getIn().setBody(response);
}
示例3: parseQuestion
import org.xbill.DNS.Type; //导入方法依赖的package包/类
private Record parseQuestion(String line) throws TextParseException {
String[] temp = line.replaceAll("\\s+", " ").split(" ");
if (Type.value(temp[2]) == -1) {
System.out.println(temp[2]);
}
return Record.newRecord(Name.fromString(temp[0]), Type.value(temp[2]), DClass.value(temp[1]));
}
示例4: onItemSelected
import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String selected = (String) (((Spinner) findViewById(R.id.spinnerKnownTypes))).getSelectedItem();
String selectedNumber = "" + Type.value(selected);
(((EditText) findViewById(R.id.txtQTYPE))).setText(selectedNumber);
}
示例5: DNSLookupEntry
import org.xbill.DNS.Type; //导入方法依赖的package包/类
public DNSLookupEntry(String name, String type) throws TextParseException{
this(name, Type.value(type));
}