當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.value方法代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:28,代碼來源:DnsLookupProducer.java

示例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);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:29,代碼來源:DnsDigProducer.java

示例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]));
}
 
開發者ID:ibauersachs,項目名稱:dnssecjava,代碼行數:9,代碼來源:RplParser.java

示例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);
}
 
開發者ID:gryphius,項目名稱:androdns,代碼行數:7,代碼來源:DNSFormActivity.java

示例5: DNSLookupEntry

import org.xbill.DNS.Type; //導入方法依賴的package包/類
public DNSLookupEntry(String name, String type) throws TextParseException{
	this(name, Type.value(type));
}
 
開發者ID:PRTG,項目名稱:JMXMiniProbe,代碼行數:4,代碼來源:DNSLookupEntry.java


注:本文中的org.xbill.DNS.Type.value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。