FileDocCategorySizeDatePackage
MyData.javaAPI DocExample1045Sun Mar 07 09:03:32 GMT 2004None

MyData

public class MyData extends Object implements Serializable
Simple data class used in Serialization demos.

Fields Summary
String
userName
String
passwordCypher
transient String
passwordClear
Constructors Summary
public MyData()
This constructor is required for use by JDO

		// Nothing to do
	
public MyData(String name, String clear)

		setUserName(name);
		setPassword(clear);
	
Methods Summary
protected java.lang.Stringencrypt(java.lang.String s)
In real life this would use Java Cryptography

		return "fjslkjlqj2TOP+SECRETkjlskl";
	
public java.lang.StringgetPasswordCypher()

		return passwordCypher;
	
public java.lang.StringgetUserName()

		return userName;
	
public voidsetPassword(java.lang.String s)
Save the clear text p/w in the object, it won't get serialized So we must save the encryption! Encryption not shown here.

		this.passwordClear = s;
		passwordCypher = encrypt(passwordClear);
	
public voidsetUserName(java.lang.String s)

		this.userName = s;
	
public java.lang.StringtoString()

		return "MyData[" + userName + ",XXXXX]";