BAEL-1727 (#4575)
* Moved Lambda examples to separate module Implementation of API Gateway example * Format fixes * Format fixes * Minor fixes * Minor fixes * Minor fixes * Adding SAM templates for "Introduction to AWS Serverless Application Model" * Fixing formatting with spaces
This commit is contained in:
parent
4e785fdc15
commit
f6f62ea0f5
75
aws-lambda/sam-templates/template-implicit.yaml
Normal file
75
aws-lambda/sam-templates/template-implicit.yaml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
AWSTemplateFormatVersion: '2010-09-09'
|
||||||
|
Transform: 'AWS::Serverless-2016-10-31'
|
||||||
|
Description: Baeldung Serverless Application Model Example with Implicit API Definition
|
||||||
|
Globals:
|
||||||
|
Api:
|
||||||
|
EndpointConfiguration: REGIONAL
|
||||||
|
Name: "TestAPI"
|
||||||
|
Resources:
|
||||||
|
PersonTable:
|
||||||
|
Type: AWS::Serverless::SimpleTable
|
||||||
|
Properties:
|
||||||
|
PrimaryKey:
|
||||||
|
Name: id
|
||||||
|
Type: Number
|
||||||
|
TableName: Person
|
||||||
|
StorePersonFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleRequest
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBCrudPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
StoreApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons
|
||||||
|
Method: PUT
|
||||||
|
GetPersonByPathParamFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByPathParam
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBReadPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
GetByPathApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons/{id}
|
||||||
|
Method: GET
|
||||||
|
GetPersonByQueryParamFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByQueryParam
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBReadPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
GetByQueryApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons
|
||||||
|
Method: GET
|
127
aws-lambda/sam-templates/template-inline-swagger.yaml
Normal file
127
aws-lambda/sam-templates/template-inline-swagger.yaml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
AWSTemplateFormatVersion: '2010-09-09'
|
||||||
|
Transform: 'AWS::Serverless-2016-10-31'
|
||||||
|
Description: Baeldung Serverless Application Model Example with Inline Swagger API Definition
|
||||||
|
Resources:
|
||||||
|
PersonTable:
|
||||||
|
Type: AWS::Serverless::SimpleTable
|
||||||
|
Properties:
|
||||||
|
PrimaryKey:
|
||||||
|
Name: id
|
||||||
|
Type: Number
|
||||||
|
TableName: Person
|
||||||
|
StorePersonFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleRequest
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBCrudPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
StoreApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons
|
||||||
|
Method: PUT
|
||||||
|
RestApiId:
|
||||||
|
Ref: MyApi
|
||||||
|
GetPersonByPathParamFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByPathParam
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBReadPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
GetByPathApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons/{id}
|
||||||
|
Method: GET
|
||||||
|
RestApiId:
|
||||||
|
Ref: MyApi
|
||||||
|
GetPersonByQueryParamFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: com.baeldung.lambda.apigateway.APIDemoHandler::handleGetByQueryParam
|
||||||
|
Runtime: java8
|
||||||
|
Timeout: 15
|
||||||
|
MemorySize: 512
|
||||||
|
CodeUri: ../target/aws-lambda-0.1.0-SNAPSHOT.jar
|
||||||
|
Policies:
|
||||||
|
- DynamoDBReadPolicy:
|
||||||
|
TableName: !Ref PersonTable
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
TABLE_NAME: !Ref PersonTable
|
||||||
|
Events:
|
||||||
|
GetByQueryApi:
|
||||||
|
Type: Api
|
||||||
|
Properties:
|
||||||
|
Path: /persons
|
||||||
|
Method: GET
|
||||||
|
RestApiId:
|
||||||
|
Ref: MyApi
|
||||||
|
MyApi:
|
||||||
|
Type: AWS::Serverless::Api
|
||||||
|
Properties:
|
||||||
|
StageName: test
|
||||||
|
EndpointConfiguration: REGIONAL
|
||||||
|
DefinitionBody:
|
||||||
|
swagger: "2.0"
|
||||||
|
info:
|
||||||
|
title: "TestAPI"
|
||||||
|
paths:
|
||||||
|
/persons:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- name: "id"
|
||||||
|
in: "query"
|
||||||
|
required: true
|
||||||
|
type: "string"
|
||||||
|
x-amazon-apigateway-request-validator: "Validate query string parameters and\
|
||||||
|
\ headers"
|
||||||
|
x-amazon-apigateway-integration:
|
||||||
|
uri:
|
||||||
|
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetPersonByQueryParamFunction.Arn}/invocations
|
||||||
|
responses: {}
|
||||||
|
httpMethod: "POST"
|
||||||
|
type: "aws_proxy"
|
||||||
|
put:
|
||||||
|
x-amazon-apigateway-integration:
|
||||||
|
uri:
|
||||||
|
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${StorePersonFunction.Arn}/invocations
|
||||||
|
responses: {}
|
||||||
|
httpMethod: "POST"
|
||||||
|
type: "aws_proxy"
|
||||||
|
/persons/{id}:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- name: "id"
|
||||||
|
in: "path"
|
||||||
|
required: true
|
||||||
|
type: "string"
|
||||||
|
responses: {}
|
||||||
|
x-amazon-apigateway-integration:
|
||||||
|
uri:
|
||||||
|
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetPersonByPathParamFunction.Arn}/invocations
|
||||||
|
responses: {}
|
||||||
|
httpMethod: "POST"
|
||||||
|
type: "aws_proxy"
|
||||||
|
x-amazon-apigateway-request-validators:
|
||||||
|
Validate query string parameters and headers:
|
||||||
|
validateRequestParameters: true
|
||||||
|
validateRequestBody: false
|
@ -15,152 +15,152 @@ import java.io.*;
|
|||||||
|
|
||||||
public class APIDemoHandler implements RequestStreamHandler {
|
public class APIDemoHandler implements RequestStreamHandler {
|
||||||
|
|
||||||
private JSONParser parser = new JSONParser();
|
private JSONParser parser = new JSONParser();
|
||||||
private static final String DYNAMODB_TABLE_NAME = System.getenv("TABLE_NAME");
|
private static final String DYNAMODB_TABLE_NAME = System.getenv("TABLE_NAME");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
|
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
JSONObject responseJson = new JSONObject();
|
JSONObject responseJson = new JSONObject();
|
||||||
|
|
||||||
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
||||||
DynamoDB dynamoDb = new DynamoDB(client);
|
DynamoDB dynamoDb = new DynamoDB(client);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject event = (JSONObject) parser.parse(reader);
|
JSONObject event = (JSONObject) parser.parse(reader);
|
||||||
|
|
||||||
if (event.get("body") != null) {
|
if (event.get("body") != null) {
|
||||||
|
|
||||||
Person person = new Person((String) event.get("body"));
|
Person person = new Person((String) event.get("body"));
|
||||||
|
|
||||||
dynamoDb.getTable(DYNAMODB_TABLE_NAME)
|
dynamoDb.getTable(DYNAMODB_TABLE_NAME)
|
||||||
.putItem(new PutItemSpec().withItem(new Item().withNumber("id", person.getId())
|
.putItem(new PutItemSpec().withItem(new Item().withNumber("id", person.getId())
|
||||||
.withString("firstName", person.getFirstName())
|
.withString("firstName", person.getFirstName())
|
||||||
.withString("lastName", person.getLastName()).withNumber("age", person.getAge())
|
.withString("lastName", person.getLastName()).withNumber("age", person.getAge())
|
||||||
.withString("address", person.getAddress())));
|
.withString("address", person.getAddress())));
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject responseBody = new JSONObject();
|
JSONObject responseBody = new JSONObject();
|
||||||
responseBody.put("message", "New item created");
|
responseBody.put("message", "New item created");
|
||||||
|
|
||||||
JSONObject headerJson = new JSONObject();
|
JSONObject headerJson = new JSONObject();
|
||||||
headerJson.put("x-custom-header", "my custom header value");
|
headerJson.put("x-custom-header", "my custom header value");
|
||||||
|
|
||||||
responseJson.put("statusCode", 200);
|
responseJson.put("statusCode", 200);
|
||||||
responseJson.put("headers", headerJson);
|
responseJson.put("headers", headerJson);
|
||||||
responseJson.put("body", responseBody.toString());
|
responseJson.put("body", responseBody.toString());
|
||||||
|
|
||||||
} catch (ParseException pex) {
|
} catch (ParseException pex) {
|
||||||
responseJson.put("statusCode", 400);
|
responseJson.put("statusCode", 400);
|
||||||
responseJson.put("exception", pex);
|
responseJson.put("exception", pex);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
||||||
writer.write(responseJson.toString());
|
writer.write(responseJson.toString());
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleGetByPathParam(InputStream inputStream, OutputStream outputStream, Context context)
|
public void handleGetByPathParam(InputStream inputStream, OutputStream outputStream, Context context)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
JSONObject responseJson = new JSONObject();
|
JSONObject responseJson = new JSONObject();
|
||||||
|
|
||||||
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
||||||
DynamoDB dynamoDb = new DynamoDB(client);
|
DynamoDB dynamoDb = new DynamoDB(client);
|
||||||
|
|
||||||
Item result = null;
|
Item result = null;
|
||||||
try {
|
try {
|
||||||
JSONObject event = (JSONObject) parser.parse(reader);
|
JSONObject event = (JSONObject) parser.parse(reader);
|
||||||
JSONObject responseBody = new JSONObject();
|
JSONObject responseBody = new JSONObject();
|
||||||
|
|
||||||
if (event.get("pathParameters") != null) {
|
if (event.get("pathParameters") != null) {
|
||||||
|
|
||||||
JSONObject pps = (JSONObject) event.get("pathParameters");
|
JSONObject pps = (JSONObject) event.get("pathParameters");
|
||||||
if (pps.get("id") != null) {
|
if (pps.get("id") != null) {
|
||||||
|
|
||||||
int id = Integer.parseInt((String) pps.get("id"));
|
int id = Integer.parseInt((String) pps.get("id"));
|
||||||
result = dynamoDb.getTable(DYNAMODB_TABLE_NAME).getItem("id", id);
|
result = dynamoDb.getTable(DYNAMODB_TABLE_NAME).getItem("id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
||||||
Person person = new Person(result.toJSON());
|
Person person = new Person(result.toJSON());
|
||||||
responseBody.put("Person", person);
|
responseBody.put("Person", person);
|
||||||
responseJson.put("statusCode", 200);
|
responseJson.put("statusCode", 200);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
responseBody.put("message", "No item found");
|
responseBody.put("message", "No item found");
|
||||||
responseJson.put("statusCode", 404);
|
responseJson.put("statusCode", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject headerJson = new JSONObject();
|
JSONObject headerJson = new JSONObject();
|
||||||
headerJson.put("x-custom-header", "my custom header value");
|
headerJson.put("x-custom-header", "my custom header value");
|
||||||
|
|
||||||
responseJson.put("headers", headerJson);
|
responseJson.put("headers", headerJson);
|
||||||
responseJson.put("body", responseBody.toString());
|
responseJson.put("body", responseBody.toString());
|
||||||
|
|
||||||
} catch (ParseException pex) {
|
} catch (ParseException pex) {
|
||||||
responseJson.put("statusCode", 400);
|
responseJson.put("statusCode", 400);
|
||||||
responseJson.put("exception", pex);
|
responseJson.put("exception", pex);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
||||||
writer.write(responseJson.toString());
|
writer.write(responseJson.toString());
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleGetByQueryParam(InputStream inputStream, OutputStream outputStream, Context context)
|
public void handleGetByQueryParam(InputStream inputStream, OutputStream outputStream, Context context)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
JSONObject responseJson = new JSONObject();
|
JSONObject responseJson = new JSONObject();
|
||||||
|
|
||||||
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient();
|
||||||
DynamoDB dynamoDb = new DynamoDB(client);
|
DynamoDB dynamoDb = new DynamoDB(client);
|
||||||
|
|
||||||
Item result = null;
|
Item result = null;
|
||||||
try {
|
try {
|
||||||
JSONObject event = (JSONObject) parser.parse(reader);
|
JSONObject event = (JSONObject) parser.parse(reader);
|
||||||
JSONObject responseBody = new JSONObject();
|
JSONObject responseBody = new JSONObject();
|
||||||
|
|
||||||
if (event.get("queryStringParameters") != null) {
|
if (event.get("queryStringParameters") != null) {
|
||||||
|
|
||||||
JSONObject qps = (JSONObject) event.get("queryStringParameters");
|
JSONObject qps = (JSONObject) event.get("queryStringParameters");
|
||||||
if (qps.get("id") != null) {
|
if (qps.get("id") != null) {
|
||||||
|
|
||||||
int id = Integer.parseInt((String) qps.get("id"));
|
int id = Integer.parseInt((String) qps.get("id"));
|
||||||
result = dynamoDb.getTable(DYNAMODB_TABLE_NAME).getItem("id", id);
|
result = dynamoDb.getTable(DYNAMODB_TABLE_NAME).getItem("id", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
||||||
Person person = new Person(result.toJSON());
|
Person person = new Person(result.toJSON());
|
||||||
responseBody.put("Person", person);
|
responseBody.put("Person", person);
|
||||||
responseJson.put("statusCode", 200);
|
responseJson.put("statusCode", 200);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
responseBody.put("message", "No item found");
|
responseBody.put("message", "No item found");
|
||||||
responseJson.put("statusCode", 404);
|
responseJson.put("statusCode", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject headerJson = new JSONObject();
|
JSONObject headerJson = new JSONObject();
|
||||||
headerJson.put("x-custom-header", "my custom header value");
|
headerJson.put("x-custom-header", "my custom header value");
|
||||||
|
|
||||||
responseJson.put("headers", headerJson);
|
responseJson.put("headers", headerJson);
|
||||||
responseJson.put("body", responseBody.toString());
|
responseJson.put("body", responseBody.toString());
|
||||||
|
|
||||||
} catch (ParseException pex) {
|
} catch (ParseException pex) {
|
||||||
responseJson.put("statusCode", 400);
|
responseJson.put("statusCode", 400);
|
||||||
responseJson.put("exception", pex);
|
responseJson.put("exception", pex);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
|
||||||
writer.write(responseJson.toString());
|
writer.write(responseJson.toString());
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,64 +5,64 @@ import com.google.gson.GsonBuilder;
|
|||||||
|
|
||||||
public class Person {
|
public class Person {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String firstName;
|
private String firstName;
|
||||||
private String lastName;
|
private String lastName;
|
||||||
private int age;
|
private int age;
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
public Person(String json) {
|
public Person(String json) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Person request = gson.fromJson(json, Person.class);
|
Person request = gson.fromJson(json, Person.class);
|
||||||
this.id = request.getId();
|
this.id = request.getId();
|
||||||
this.firstName = request.getFirstName();
|
this.firstName = request.getFirstName();
|
||||||
this.lastName = request.getLastName();
|
this.lastName = request.getLastName();
|
||||||
this.age = request.getAge();
|
this.age = request.getAge();
|
||||||
this.address = request.getAddress();
|
this.address = request.getAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
return gson.toJson(this);
|
return gson.toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFirstName() {
|
public String getFirstName() {
|
||||||
return firstName;
|
return firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstName(String firstName) {
|
public void setFirstName(String firstName) {
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastName() {
|
public String getLastName() {
|
||||||
return lastName;
|
return lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastName(String lastName) {
|
public void setLastName(String lastName) {
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(String address) {
|
public void setAddress(String address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user