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


Java GetField.get方法代碼示例

本文整理匯總了Java中java.io.ObjectInputStream.GetField.get方法的典型用法代碼示例。如果您正苦於以下問題:Java GetField.get方法的具體用法?Java GetField.get怎麽用?Java GetField.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.ObjectInputStream.GetField的用法示例。


在下文中一共展示了GetField.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
/**
 * Ensure that previously-serialized instances don't fail due to the member name change.
 */
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
{
    GetField fields = is.readFields();
    if (fields.defaulted("first"))
    {
        // This is a pre-V3.3
        this.first = (F) fields.get("fFirst", null);
        this.second = (S) fields.get("fSecond", null);
    }
    else
    {
        this.first = (F) fields.get("first", null);
        this.second = (S) fields.get("second", null);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-core,代碼行數:20,代碼來源:Pair.java

示例2: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
/**
 * readObject is called to restore the state of the URL from the
 * stream.  It reads the components of the URL and finds the local
 * stream handler.
 */
private synchronized void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    GetField gf = s.readFields();
    String protocol = (String)gf.get("protocol", null);
    if (getURLStreamHandler(protocol) == null) {
        throw new IOException("unknown protocol: " + protocol);
    }
    String host = (String)gf.get("host", null);
    int port = gf.get("port", -1);
    String authority = (String)gf.get("authority", null);
    String file = (String)gf.get("file", null);
    String ref = (String)gf.get("ref", null);
    int hashCode = gf.get("hashCode", -1);
    if (authority == null
            && ((host != null && host.length() > 0) || port != -1)) {
        if (host == null)
            host = "";
        authority = (port == -1) ? host : host + ":" + port;
    }
    tempState = new UrlDeserializedState(protocol, host, port, authority,
           file, ref, hashCode);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:28,代碼來源:URL.java

示例3: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
{
	GetField fields = stream.readFields();
	fromVariable = (String) fields.get("fromVariable", null);
	
	// the fields of BaseCommonReturnValue were originally in this class.
	// if deserializing an old object, we need to manually copy the values into the parent class.
	ObjectStreamClass streamClass = fields.getObjectStreamClass();
	if (streamClass.getField("toVariable") != null)
	{
		this.toVariable = (String) fields.get("toVariable", null);
	}
	if (streamClass.getField("calculation") != null)
	{
		this.calculation = (CalculationEnum) fields.get("calculation", null);
	}
	if (streamClass.getField("incrementerFactoryClassName") != null)
	{
		this.incrementerFactoryClassName = (String) fields.get("incrementerFactoryClassName", null);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:22,代碼來源:BaseReturnValue.java

示例4: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
{
	setThreadJasperReportsContext();

	GetField fields = in.readFields();
	cachedRenderers = (Map<String, Renderable>) fields.get("cachedRenderers", null);
	cachedTemplates = (Map<String, JRTemplateElement>) fields.get("cachedTemplates", null);
	readOnly = fields.get("readOnly", false);
	// use configured default if serialized by old version
	pageElementSize = fields.get("pageElementSize", JRPropertiesUtil.getInstance(jasperReportsContext).getIntegerProperty(
			JRVirtualPrintPage.PROPERTY_VIRTUAL_PAGE_ELEMENT_SIZE, 0));
	
	setThreadVirtualizer();
	
	initLock();
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:18,代碼來源:JRVirtualizationContext.java

示例5: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	GetField fields = in.readFields();
	this.PSEUDO_SERIAL_VERSION_UID = fields.get("PSEUDO_SERIAL_VERSION_UID", 0);
	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
	{
		byte evaluationTime = fields.get("evaluationTime", (byte) 0);
		this.evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
	}
	else
	{
		this.evaluationTimeValue = (EvaluationTimeEnum) fields.get("evaluationTimeValue", null);
	}
	this.evaluationGroup = (String) fields.get("evaluationGroup", null);
	this.codeExpression = (JRExpression) fields.get("codeExpression", null);
	
	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2
			&& this instanceof Barcode4jComponent)
	{
		//up to 6.0.0 this class had several fields that were moved to Barcode4jComponent in 6.0.2.
		//copying the values to the Barcode4jComponent fields.
		Barcode4jComponent barcode4jComponent = (Barcode4jComponent) this;
		barcode4jComponent.copyBarcodeComponentFields(fields);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:27,代碼來源:BarcodeComponent.java

示例6: doReadObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
/**
 * Subclasses should call this method within their
 * readObject(ObjectInputStream) invocations
 *
 * @param stream
 * @throws IOException
 * @throws ClassNotFoundException
 */
protected void doReadObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
    final GetField readFields = stream.readFields();

    for (final String fieldName : getFieldNamesInAdditionToId()) {
        final Object value = readFields.get(fieldName, null);
        setField(fieldName, value);
    }

    // fix issue of deserializing _rowNumber in it's previous int form
    final long rowNumber;
    final ObjectStreamField legacyRowNumberField =
            readFields.getObjectStreamClass().getField(getFieldNameForOldId());
    if (legacyRowNumberField != null) {
        rowNumber = readFields.get(getFieldNameForOldId(), -1);
    } else {
        rowNumber = readFields.get(getFieldNameForNewId(), -1L);
    }

    setField(getFieldNameForNewId(), rowNumber);
}
 
開發者ID:datacleaner,項目名稱:DataCleaner,代碼行數:29,代碼來源:AbstractLegacyAwareInputRow.java

示例7: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
/**
 * Method invoked by the Java serialization framework while deserializing
 * Row instances. Since previous versions of MetaModel did not use a
 * DataSetHeader, but had a reference to a List&lt;SelectItem&gt;, this
 * deserialization is particularly tricky. We check if the items variable is
 * there, and if it is, we convert it to a header instead.
 * 
 * @param stream
 * @throws Exception
 */
private void readObject(ObjectInputStream stream) throws Exception {
    GetField fields = stream.readFields();

    try {
        // backwards compatible deserialization, convert items to header
        Object items = fields.get("_items", null);
        @SuppressWarnings("unchecked")
        List<SelectItem> itemsList = (List<SelectItem>) items;
        SimpleDataSetHeader header = new SimpleDataSetHeader(itemsList);
        Field field = getClass().getDeclaredField("_header");
        field.setAccessible(true);
        field.set(this, header);
    } catch (IllegalArgumentException e) {
        // no backwards compatible deserialization needed.
        setWhileDeserializing(fields, "_header");
    }

    setWhileDeserializing(fields, "_values");
    setWhileDeserializing(fields, "_styles");
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:31,代碼來源:DefaultRow.java

示例8: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "deprecation" })
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
{
    GetField fields = is.readFields();
    if (fields.defaulted("versionsByLabel"))
    {
        // This is a V2.2 class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (HashMap<String, Version>) fields.get("versions", new HashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        // Need this comparator as versionsByLabel is not a LinkedHashMap in this version 
        this.versionComparatorDesc = new VersionLabelComparator(); 
    }
    else if (fields.defaulted("versionComparatorDesc"))
    {
        // This is a V3.1.0 class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (HashMap<String, Version>) fields.get("versionsByLabel", new HashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        // Need this comparator as versionsByLabel is not a LinkedHashMap in this version 
        this.versionComparatorDesc = new VersionLabelComparator(); 
    }
    else
    {
        // This is a V4.1.3 (and 4.0.2 HF) class
        // The old 'rootVersion' maps to the current 'rootVersion'
        this.versionsByLabel = (Map<String, Version>) fields.get("versionsByLabel", new LinkedHashMap<String, Version>());
        // The old 'versionHistory' maps to the current 'versionHistory'
        this.versionHistory = (HashMap<String, String>) fields.get("versionHistory", new HashMap<String, String>());
        this.versionComparatorDesc = (Comparator<Version>) fields.get("versionComparatorDesc", null); 
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:35,代碼來源:VersionHistoryImpl.java

示例9: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private void readObject (ObjectInputStream s) throws
                     IOException, ClassNotFoundException {
    if (getClass().getClassLoader() != null) {
        throw new SecurityException ("invalid address type");
    }
    GetField gf = s.readFields();
    String host = (String)gf.get("hostName", null);
    int address= gf.get("address", 0);
    int family= gf.get("family", 0);
    InetAddressHolder h = new InetAddressHolder(host, address, family);
    UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:InetAddress.java

示例10: copyBarcodeComponentFields

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
protected final void copyBarcodeComponentFields(GetField fields) throws IOException
{
	int orientation = fields.get("orientation", 0);
	this.orientationValue = OrientationEnum.getByValue(orientation);
	this.patternExpression = (JRExpression) fields.get("patternExpression", null);
	this.moduleWidth = (Double) fields.get("moduleWidth", null);
	String textPosition = (String) fields.get("textPosition", null);
	this.textPositionValue = TextPositionEnum.getByName(textPosition);
	this.quietZone = (Double) fields.get("quietZone", null);
	this.verticalQuietZone = (Double) fields.get("verticalQuietZone", null);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:12,代碼來源:Barcode4jComponent.java

示例11: readObject

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    GetField fields = stream.readFields();
    comparator = (Comparator<? super K>) fields.get("comparator", null);
    if (comparator == null) {
        comparator = (Comparator<? super K>) NATURAL_ORDER;
    }
    int size = stream.readInt();
    for (int i = 0; i < size; i++) {
        putInternal((K) stream.readObject(), (V) stream.readObject());
    }
}
 
開發者ID:jtransc,項目名稱:jtransc,代碼行數:13,代碼來源:TreeMap.java

示例12: readStringField

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private String readStringField(GetField fields, String name, String defaultValue) {
    try {
        return (String) fields.get(name, defaultValue);
    } catch (Exception e) {
        logger.debug(readErrorMessage, name, e.getMessage());
        return defaultValue;
    }
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:9,代碼來源:ActivityState.java

示例13: readBooleanField

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private boolean readBooleanField(GetField fields, String name, boolean defaultValue) {
    try {
        return fields.get(name, defaultValue);
    } catch (Exception e) {
        logger.debug(readErrorMessage, name, e.getMessage());
        return defaultValue;
    }
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:9,代碼來源:ActivityState.java

示例14: readIntField

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private int readIntField(GetField fields, String name, int defaultValue) {
    try {
        return fields.get(name, defaultValue);
    } catch (Exception e) {
        logger.debug(readErrorMessage, name, e.getMessage());
        return defaultValue;
    }
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:9,代碼來源:ActivityState.java

示例15: readLongField

import java.io.ObjectInputStream.GetField; //導入方法依賴的package包/類
private long readLongField(GetField fields, String name, long defaultValue) {
    try {
        return fields.get(name, defaultValue);
    } catch (Exception e) {
        logger.debug(readErrorMessage, name, e.getMessage());
        return defaultValue;
    }
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:9,代碼來源:ActivityState.java


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