Skip to content

Commit b08abb8

Browse files
Add a copy constructor to AuthzDetailsElement
1 parent 6a01d3b commit b08abb8

1 file changed

Lines changed: 39 additions & 2 deletions

File tree

src/main/java/com/authlete/common/dto/AuthzDetailsElement.java

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2021 Authlete, Inc.
2+
* Copyright (C) 2019-2026 Authlete, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
3030
*/
3131
public class AuthzDetailsElement implements Serializable
3232
{
33-
private static final long serialVersionUID = 4L;
33+
private static final long serialVersionUID = 5L;
3434

3535

3636
private String type;
@@ -42,6 +42,43 @@ public class AuthzDetailsElement implements Serializable
4242
private String otherFields;
4343

4444

45+
/**
46+
* The default constructor.
47+
*/
48+
public AuthzDetailsElement()
49+
{
50+
}
51+
52+
53+
/**
54+
* The copy constructor.
55+
*
56+
* @param element
57+
* The source instance.
58+
*
59+
* @since 4.34
60+
*/
61+
public AuthzDetailsElement(AuthzDetailsElement element)
62+
{
63+
if (element != null)
64+
{
65+
this.type = element.type;
66+
this.locations = copy(element.locations);
67+
this.actions = copy(element.actions);
68+
this.dataTypes = copy(element.dataTypes);
69+
this.identifier = element.identifier;
70+
this.privileges = copy(element.privileges);
71+
this.otherFields = element.otherFields;
72+
}
73+
}
74+
75+
76+
private static String[] copy(String[] source)
77+
{
78+
return (source != null) ? source.clone() : null;
79+
}
80+
81+
4582
/**
4683
* Get the type of this element.
4784
*

0 commit comments

Comments
 (0)