Skip to content

Commit 3f078e7

Browse files
author
Tom Wilkie
committed
Merge branch 'master' of https://github.com/msgpack/msgpack-java
2 parents e771b9a + 53ae53a commit 3f078e7

31 files changed

+5847
-35
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Release 0.6.7 - 20XX/XX/XX
1+
Release 0.6.8 - 20XX/XX/XX
2+
3+
Release 0.6.7 - 2012/12/09
4+
NEW FEATURES
5+
Adds MessagePack for Android
6+
27
BUG FIXES
38
MSGPACK-78 Generated template causes SecurityException when used from Java web start applications
49
MSGPACK-76 Tries to generate a template of an abstract class

NOTICE

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
This project uses code from the ASF Apache Harmony project. The following are the relevant notices
2+
from that project, included in order to comply with its license requirements.
3+
-------------------
4+
Apache Harmony
5+
Copyright 2006, 2010 The Apache Software Foundation.
6+
7+
This product includes software developed at
8+
The Apache Software Foundation (http://www.apache.org/).
9+
10+
Portions of Apache Harmony were originally developed by
11+
Intel Corporation and are licensed to the Apache Software
12+
Foundation under the "Software Grant and Corporate Contribution
13+
License Agreement" and for which the following copyright notices
14+
apply
15+
(C) Copyright 2005 Intel Corporation
16+
(C) Copyright 2005-2006 Intel Corporation
17+
(C) Copyright 2006 Intel Corporation
18+
19+
Portions of Apache Harmony's Class Library TEXT module contain JavaDoc
20+
derived from the ICU project.
21+
Copyright (c) 1995-2008 International Business Machines Corporation and others
22+
23+
24+
The Apache Harmony Development Kit (HDK) contains a jar file from the
25+
Apache Derby Project for which the following notice applies:
26+
27+
Apache Derby
28+
Copyright 2004-2007 The Apache Software Foundation
29+
30+
This product includes software developed by
31+
The Apache Software Foundation (http://www.apache.org/).
32+
33+
Portions of Derby were originally developed by
34+
International Business Machines Corporation and are
35+
licensed to the Apache Software Foundation under the
36+
"Software Grant and Corporate Contribution License Agreement",
37+
informally known as the "Derby CLA".
38+
The following copyright notice(s) were affixed to portions of the code
39+
with which this file is now or was at one time distributed
40+
and are placed here unaltered.
41+
42+
(C) Copyright 1997,2004 International Business Machines Corporation.
43+
All rights reserved.
44+
45+
(C) Copyright IBM Corp. 2003.
46+
47+
The portion of the functionTests under 'nist' was originally
48+
developed by the National Institute of Standards and Technology (NIST),
49+
an agency of the United States Department of Commerce, and adapted by
50+
International Business Machines Corporation in accordance with the NIST
51+
Software Acknowledgment and Redistribution document at
52+
http://www.itl.nist.gov/div897/ctg/sql_form.htm

README

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# MessagePack for Java
2+
3+
An implementation of [MessagePack](http://msgpack.org/) for Java.
4+
5+
## Installation
6+
7+
To build the JAR file of MessagePack, you need to install Maven (http://maven.apache.org), then type the following command:
8+
9+
$ mvn package
10+
11+
To locally install the project, type
12+
13+
$ mvn install
14+
15+
To generate project files (.project, .classpath) for Eclipse, do
16+
17+
$ mvn eclipse:eclipse
18+
19+
then import the folder from your Eclipse.
20+
21+
Next, open the preference page in Eclipse and add the CLASSPATH variable:
22+
23+
M2_REPO = $HOME/.m2/repository
24+
25+
where $HOME is your home directory. In Windows XP, $HOME is:
26+
27+
C:/Documents and Settings/(user name)/.m2/repository
28+
29+
30+
## How to release
31+
32+
To relese the project (compile, test, tagging, deploy), please use the commands as follows:
33+
34+
$ mvn release:prepare
35+
$ mvn release:perform
36+
37+

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<name>MessagePack for Java</name>
77
<description>MessagePack for Java is a binary-based efficient object
88
serialization library in Java.</description>
9-
<version>0.6.7-SNAPSHOT</version>
9+
<version>0.6.8-SNAPSHOT</version>
1010
<packaging>bundle</packaging>
1111
<url>http://msgpack.org/</url>
1212

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// MODIFIED FOR THE MSGPACK PROJECT
2+
// Licensed to the Apache Software Foundation (ASF) under one or more
3+
// contributor license agreements. See the NOTICE file distributed with
4+
// this work for additional information regarding copyright ownership.
5+
// The ASF licenses this file to You under the Apache License, Version 2.0
6+
// (the "License"); you may not use this file except in compliance with
7+
// the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
// License for the specific language governing permissions and limitations under
15+
// the License.
16+
//
17+
18+
package org.apache.harmony.beans;
19+
20+
public class Argument {
21+
22+
private Class<?> type;
23+
24+
private Object value;
25+
26+
private Class<?>[] interfaces;
27+
28+
public Argument(Object value) {
29+
this.value = value;
30+
if (this.value != null) {
31+
this.type = value.getClass();
32+
this.interfaces = this.type.getInterfaces();
33+
}
34+
}
35+
36+
public Argument(Class<?> type, Object value) {
37+
this.type = type;
38+
this.value = value;
39+
this.interfaces = type.getInterfaces();
40+
}
41+
42+
public Class<?> getType() {
43+
return type;
44+
}
45+
46+
public Object getValue() {
47+
return value;
48+
}
49+
50+
public Class<?>[] getInterfaces() {
51+
return interfaces;
52+
}
53+
54+
public void setType(Class<?> type) {
55+
this.type = type;
56+
this.interfaces = type.getInterfaces();
57+
}
58+
59+
public void setInterfaces(Class<?>[] interfaces) {
60+
this.interfaces = interfaces;
61+
}
62+
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// MODIFIED FOR THE MSGPACK PROJECT
2+
// Licensed to the Apache Software Foundation (ASF) under one or more
3+
// contributor license agreements. See the NOTICE file distributed with
4+
// this work for additional information regarding copyright ownership.
5+
// The ASF licenses this file to You under the Apache License, Version 2.0
6+
// (the "License"); you may not use this file except in compliance with
7+
// the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
// License for the specific language governing permissions and limitations under
15+
// the License.
16+
//
17+
18+
package org.apache.harmony.beans;
19+
20+
import java.lang.reflect.Method;
21+
import java.util.Arrays;
22+
23+
public class BeansUtils {
24+
25+
public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
26+
27+
public static final String NEW = "new"; //$NON-NLS-1$
28+
29+
public static final String NEWINSTANCE = "newInstance"; //$NON-NLS-1$
30+
31+
public static final String NEWARRAY = "newArray"; //$NON-NLS-1$
32+
33+
public static final String FORNAME = "forName"; //$NON-NLS-1$
34+
35+
public static final String GET = "get"; //$NON-NLS-1$
36+
37+
public static final String IS = "is"; //$NON-NLS-1$
38+
39+
public static final String SET = "set"; //$NON-NLS-1$
40+
41+
public static final String ADD = "add"; //$NON-NLS-1$
42+
43+
public static final String PUT = "put"; //$NON-NLS-1$
44+
45+
public static final String NULL = "null"; //$NON-NLS-1$
46+
47+
public static final String QUOTE = "\"\""; //$NON-NLS-1$
48+
49+
public static final int getHashCode(Object obj) {
50+
return obj != null ? obj.hashCode() : 0;
51+
}
52+
53+
public static final int getHashCode(boolean bool) {
54+
return bool ? 1 : 0;
55+
}
56+
57+
public static String toASCIILowerCase(String string) {
58+
char[] charArray = string.toCharArray();
59+
StringBuilder sb = new StringBuilder(charArray.length);
60+
for (int index = 0; index < charArray.length; index++) {
61+
if ('A' <= charArray[index] && charArray[index] <= 'Z') {
62+
sb.append((char) (charArray[index] + ('a' - 'A')));
63+
} else {
64+
sb.append(charArray[index]);
65+
}
66+
}
67+
return sb.toString();
68+
}
69+
70+
public static String toASCIIUpperCase(String string) {
71+
char[] charArray = string.toCharArray();
72+
StringBuilder sb = new StringBuilder(charArray.length);
73+
for (int index = 0; index < charArray.length; index++) {
74+
if ('a' <= charArray[index] && charArray[index] <= 'z') {
75+
sb.append((char) (charArray[index] - ('a' - 'A')));
76+
} else {
77+
sb.append(charArray[index]);
78+
}
79+
}
80+
return sb.toString();
81+
}
82+
83+
public static boolean isPrimitiveWrapper(Class<?> wrapper, Class<?> base) {
84+
return (base == boolean.class) && (wrapper == Boolean.class)
85+
|| (base == byte.class) && (wrapper == Byte.class)
86+
|| (base == char.class) && (wrapper == Character.class)
87+
|| (base == short.class) && (wrapper == Short.class)
88+
|| (base == int.class) && (wrapper == Integer.class)
89+
|| (base == long.class) && (wrapper == Long.class)
90+
|| (base == float.class) && (wrapper == Float.class)
91+
|| (base == double.class) && (wrapper == Double.class);
92+
}
93+
94+
private static final String EQUALS_METHOD = "equals";
95+
96+
private static final Class<?>[] EQUALS_PARAMETERS = new Class<?>[] { Object.class };
97+
98+
public static boolean declaredEquals(Class<?> clazz) {
99+
for (Method declaredMethod : clazz.getDeclaredMethods()) {
100+
if (EQUALS_METHOD.equals(declaredMethod.getName())
101+
&& Arrays.equals(declaredMethod.getParameterTypes(),
102+
EQUALS_PARAMETERS)) {
103+
return true;
104+
}
105+
}
106+
return false;
107+
}
108+
109+
public static String idOfClass(Class<?> clazz) {
110+
Class<?> theClass = clazz;
111+
StringBuilder sb = new StringBuilder();
112+
if (theClass.isArray()) {
113+
do {
114+
sb.append("Array"); //$NON-NLS-1$
115+
theClass = theClass.getComponentType();
116+
} while (theClass.isArray());
117+
}
118+
String clazzName = theClass.getName();
119+
clazzName = clazzName.substring(clazzName.lastIndexOf('.') + 1);
120+
return clazzName + sb.toString();
121+
}
122+
}

0 commit comments

Comments
 (0)