repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java | IdClassMetadata.findIdReadMethod | private MethodHandle findIdReadMethod() {
try {
Method readMethod = clazz.getMethod(READ_METHOD_NAME);
Class<?> dataClass = readMethod.getReturnType();
DataType dataType = IdentifierMetadata.DataType.forClass(dataClass);
if (dataType == null) {
String pattern = "Method %s in class %s... | java | private MethodHandle findIdReadMethod() {
try {
Method readMethod = clazz.getMethod(READ_METHOD_NAME);
Class<?> dataClass = readMethod.getReturnType();
DataType dataType = IdentifierMetadata.DataType.forClass(dataClass);
if (dataType == null) {
String pattern = "Method %s in class %s... | [
"private",
"MethodHandle",
"findIdReadMethod",
"(",
")",
"{",
"try",
"{",
"Method",
"readMethod",
"=",
"clazz",
".",
"getMethod",
"(",
"READ_METHOD_NAME",
")",
";",
"Class",
"<",
"?",
">",
"dataClass",
"=",
"readMethod",
".",
"getReturnType",
"(",
")",
";",
... | Creates and returns the MethodHandle for reading the underlying ID.
@return the MethodHandle for reading the underlying ID. | [
"Creates",
"and",
"returns",
"the",
"MethodHandle",
"for",
"reading",
"the",
"underlying",
"ID",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java#L108-L124 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java | IdClassMetadata.findConstructor | private MethodHandle findConstructor() {
try {
MethodHandle mh = MethodHandles.publicLookup().findConstructor(clazz,
MethodType.methodType(void.class, getIdType()));
return mh;
} catch (NoSuchMethodException | IllegalAccessException exp) {
String pattern = "Class %s requires a public... | java | private MethodHandle findConstructor() {
try {
MethodHandle mh = MethodHandles.publicLookup().findConstructor(clazz,
MethodType.methodType(void.class, getIdType()));
return mh;
} catch (NoSuchMethodException | IllegalAccessException exp) {
String pattern = "Class %s requires a public... | [
"private",
"MethodHandle",
"findConstructor",
"(",
")",
"{",
"try",
"{",
"MethodHandle",
"mh",
"=",
"MethodHandles",
".",
"publicLookup",
"(",
")",
".",
"findConstructor",
"(",
"clazz",
",",
"MethodType",
".",
"methodType",
"(",
"void",
".",
"class",
",",
"g... | Creates and returns the MethodHandle for the constructor.
@return the MethodHandle for the constructor. | [
"Creates",
"and",
"returns",
"the",
"MethodHandle",
"for",
"the",
"constructor",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java#L131-L141 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.instantiate | public static Object instantiate(MetadataBase metadata) {
try {
return metadata.getConstructorMetadata().getConstructorMethodHandle().invoke();
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | java | public static Object instantiate(MetadataBase metadata) {
try {
return metadata.getConstructorMetadata().getConstructorMethodHandle().invoke();
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | [
"public",
"static",
"Object",
"instantiate",
"(",
"MetadataBase",
"metadata",
")",
"{",
"try",
"{",
"return",
"metadata",
".",
"getConstructorMetadata",
"(",
")",
".",
"getConstructorMethodHandle",
"(",
")",
".",
"invoke",
"(",
")",
";",
"}",
"catch",
"(",
"... | Creates and returns a new instance of a persistence class for the given metadata. The returned
object will be an instance of the primary persistence class or its Builder.
@param metadata
the metadata of the class
@return a new instance of the of the Class to which the given metadata belongs.
@throws EntityManagerExcep... | [
"Creates",
"and",
"returns",
"a",
"new",
"instance",
"of",
"a",
"persistence",
"class",
"for",
"the",
"given",
"metadata",
".",
"The",
"returned",
"object",
"will",
"be",
"an",
"instance",
"of",
"the",
"primary",
"persistence",
"class",
"or",
"its",
"Builder... | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L67-L73 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.getPropertyMetadata | public static PropertyMetadata getPropertyMetadata(Field field) {
Property property = field.getAnnotation(Property.class);
// For fields that have @Property annotation, we expect both setter and
// getter methods. For all other fields, we only treat them as
// persistable if we find valid getter and set... | java | public static PropertyMetadata getPropertyMetadata(Field field) {
Property property = field.getAnnotation(Property.class);
// For fields that have @Property annotation, we expect both setter and
// getter methods. For all other fields, we only treat them as
// persistable if we find valid getter and set... | [
"public",
"static",
"PropertyMetadata",
"getPropertyMetadata",
"(",
"Field",
"field",
")",
"{",
"Property",
"property",
"=",
"field",
".",
"getAnnotation",
"(",
"Property",
".",
"class",
")",
";",
"// For fields that have @Property annotation, we expect both setter and",
... | Returns the metadata for the given field.
@param field
the field whose metadata has to be prepared
@return metadata of the given field. | [
"Returns",
"the",
"metadata",
"for",
"the",
"given",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L82-L96 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.instantiateObject | public static Object instantiateObject(Class<?> clazz) {
try {
Constructor<?> constructor = clazz.getConstructor();
return constructor.newInstance();
} catch (Exception exp) {
throw new EntityManagerException(exp);
}
} | java | public static Object instantiateObject(Class<?> clazz) {
try {
Constructor<?> constructor = clazz.getConstructor();
return constructor.newInstance();
} catch (Exception exp) {
throw new EntityManagerException(exp);
}
} | [
"public",
"static",
"Object",
"instantiateObject",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"try",
"{",
"Constructor",
"<",
"?",
">",
"constructor",
"=",
"clazz",
".",
"getConstructor",
"(",
")",
";",
"return",
"constructor",
".",
"newInstance",
"("... | Creates a new object of given class by invoking the class' default public constructor.
@param clazz
the class whose instance needs to be created
@return a new instance of the given class
@throws EntityManagerException
if any error occurs | [
"Creates",
"a",
"new",
"object",
"of",
"given",
"class",
"by",
"invoking",
"the",
"class",
"default",
"public",
"constructor",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L258-L266 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.getFieldValue | public static Object getFieldValue(FieldMetadata fieldMetadata, Object target) {
MethodHandle readMethod = fieldMetadata.getReadMethod();
try {
return readMethod.invoke(target);
} catch (Throwable t) {
throw new EntityManagerException(t.getMessage(), t);
}
} | java | public static Object getFieldValue(FieldMetadata fieldMetadata, Object target) {
MethodHandle readMethod = fieldMetadata.getReadMethod();
try {
return readMethod.invoke(target);
} catch (Throwable t) {
throw new EntityManagerException(t.getMessage(), t);
}
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"FieldMetadata",
"fieldMetadata",
",",
"Object",
"target",
")",
"{",
"MethodHandle",
"readMethod",
"=",
"fieldMetadata",
".",
"getReadMethod",
"(",
")",
";",
"try",
"{",
"return",
"readMethod",
".",
"invoke",
"... | Returns the value of the field represented by the given metadata.
@param fieldMetadata
the metadata of the field
@param target
the target object to which the field belongs.
@return the value of the field. | [
"Returns",
"the",
"value",
"of",
"the",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L376-L383 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.findStaticMethod | public static MethodHandle findStaticMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, true, expectedReturnType, expectedParameterTypes);
} | java | public static MethodHandle findStaticMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, true, expectedReturnType, expectedParameterTypes);
} | [
"public",
"static",
"MethodHandle",
"findStaticMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"expectedReturnType",
",",
"Class",
"<",
"?",
">",
"...",
"expectedParameterTypes",
")",
"{",
"return",
"f... | Finds and returns a MethodHandle for a public static method.
@param clazz
the class to search
@param methodName
the name of the method
@param expectedReturnType
the expected return type. If {@code null}, any return type is treated as valid.
@param expectedParameterTypes
expected parameter types
@return a MethodHandle ... | [
"Finds",
"and",
"returns",
"a",
"MethodHandle",
"for",
"a",
"public",
"static",
"method",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L418-L421 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.findInstanceMethod | public static MethodHandle findInstanceMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, false, expectedReturnType, expectedParameterTypes);
} | java | public static MethodHandle findInstanceMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, false, expectedReturnType, expectedParameterTypes);
} | [
"public",
"static",
"MethodHandle",
"findInstanceMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"expectedReturnType",
",",
"Class",
"<",
"?",
">",
"...",
"expectedParameterTypes",
")",
"{",
"return",
... | Finds and returns a MethodHandle for a public instance method.
@param clazz
the class to search
@param methodName
the name of the method
@param expectedReturnType
the expected return type. If {@code null}, any return type is treated as valid.
@param expectedParameterTypes
expected parameter types
@return a MethodHandl... | [
"Finds",
"and",
"returns",
"a",
"MethodHandle",
"for",
"a",
"public",
"instance",
"method",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L437-L440 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.findMethod | private static MethodHandle findMethod(Class<?> clazz, String methodName, boolean staticMethod,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
MethodHandle methodHandle = null;
try {
Method method = clazz.getMethod(methodName, expectedParameterTypes);
int modifiers = method... | java | private static MethodHandle findMethod(Class<?> clazz, String methodName, boolean staticMethod,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
MethodHandle methodHandle = null;
try {
Method method = clazz.getMethod(methodName, expectedParameterTypes);
int modifiers = method... | [
"private",
"static",
"MethodHandle",
"findMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"boolean",
"staticMethod",
",",
"Class",
"<",
"?",
">",
"expectedReturnType",
",",
"Class",
"<",
"?",
">",
"...",
"expectedParameterTypes... | Finds and returns a method handle for the given criteria.
@param clazz
the class to search
@param methodName
the name of the method
@param staticMethod
whether the method is static or not
@param expectedReturnType
expected return type
@param expectedParameterTypes
expected parameter types
@return a methodHandle for th... | [
"Finds",
"and",
"returns",
"a",
"method",
"handle",
"for",
"the",
"given",
"criteria",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L458-L477 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java | PropertyMetadata.setOptional | public void setOptional(boolean optional) {
if (field.getType().isPrimitive() || field.isAnnotationPresent(Version.class)
|| field.isAnnotationPresent(CreatedTimestamp.class)
|| field.isAnnotationPresent(UpdatedTimestamp.class)) {
this.optional = false;
} else {
this.optional = optio... | java | public void setOptional(boolean optional) {
if (field.getType().isPrimitive() || field.isAnnotationPresent(Version.class)
|| field.isAnnotationPresent(CreatedTimestamp.class)
|| field.isAnnotationPresent(UpdatedTimestamp.class)) {
this.optional = false;
} else {
this.optional = optio... | [
"public",
"void",
"setOptional",
"(",
"boolean",
"optional",
")",
"{",
"if",
"(",
"field",
".",
"getType",
"(",
")",
".",
"isPrimitive",
"(",
")",
"||",
"field",
".",
"isAnnotationPresent",
"(",
"Version",
".",
"class",
")",
"||",
"field",
".",
"isAnnota... | Sets whether or not the field represented by this metadata is optional.
@param optional
whether or not the field represented by this metadata is optional. | [
"Sets",
"whether",
"or",
"not",
"the",
"field",
"represented",
"by",
"this",
"metadata",
"is",
"optional",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java#L197-L205 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java | PropertyMetadata.initializeSecondaryIndexer | private void initializeSecondaryIndexer() {
SecondaryIndex secondaryIndexAnnotation = field.getAnnotation(SecondaryIndex.class);
if (secondaryIndexAnnotation == null) {
return;
}
String indexName = secondaryIndexAnnotation.name();
if (indexName == null || indexName.trim().length() == 0) {
... | java | private void initializeSecondaryIndexer() {
SecondaryIndex secondaryIndexAnnotation = field.getAnnotation(SecondaryIndex.class);
if (secondaryIndexAnnotation == null) {
return;
}
String indexName = secondaryIndexAnnotation.name();
if (indexName == null || indexName.trim().length() == 0) {
... | [
"private",
"void",
"initializeSecondaryIndexer",
"(",
")",
"{",
"SecondaryIndex",
"secondaryIndexAnnotation",
"=",
"field",
".",
"getAnnotation",
"(",
"SecondaryIndex",
".",
"class",
")",
";",
"if",
"(",
"secondaryIndexAnnotation",
"==",
"null",
")",
"{",
"return",
... | Initializes the secondary indexer for this property, if any. | [
"Initializes",
"the",
"secondary",
"indexer",
"for",
"this",
"property",
"if",
"any",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java#L210-L229 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.introspect | public static EntityListenersMetadata introspect(Class<?> entityClass) {
EntityListenersIntrospector introspector = new EntityListenersIntrospector(entityClass);
introspector.introspect();
return introspector.metadata;
} | java | public static EntityListenersMetadata introspect(Class<?> entityClass) {
EntityListenersIntrospector introspector = new EntityListenersIntrospector(entityClass);
introspector.introspect();
return introspector.metadata;
} | [
"public",
"static",
"EntityListenersMetadata",
"introspect",
"(",
"Class",
"<",
"?",
">",
"entityClass",
")",
"{",
"EntityListenersIntrospector",
"introspector",
"=",
"new",
"EntityListenersIntrospector",
"(",
"entityClass",
")",
";",
"introspector",
".",
"introspect",
... | Returns the metadata of various registered listeners for the given entity class.
@param entityClass
the entity class to introspect
@return the metadata of various listeners. | [
"Returns",
"the",
"metadata",
"of",
"various",
"registered",
"listeners",
"for",
"the",
"given",
"entity",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L77-L81 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.getAllExternalListeners | private List<Class<?>> getAllExternalListeners() {
Class<?> clazz = entityClass;
List<Class<?>> allListeners = new ArrayList<>();
boolean stop = false;
while (!stop) {
EntityListeners entityListenersAnnotation = clazz.getAnnotation(EntityListeners.class);
if (entityListenersAnnotation != nul... | java | private List<Class<?>> getAllExternalListeners() {
Class<?> clazz = entityClass;
List<Class<?>> allListeners = new ArrayList<>();
boolean stop = false;
while (!stop) {
EntityListeners entityListenersAnnotation = clazz.getAnnotation(EntityListeners.class);
if (entityListenersAnnotation != nul... | [
"private",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"getAllExternalListeners",
"(",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"entityClass",
";",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"allListeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")"... | Inspects the entity hierarchy and returns all external listeners.
@return list of all external listeners | [
"Inspects",
"the",
"entity",
"hierarchy",
"and",
"returns",
"all",
"external",
"listeners",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L108-L134 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.processExternalListener | private void processExternalListener(Class<?> listenerClass) {
ExternalListenerMetadata listenerMetadata = ExternalListenerIntrospector
.introspect(listenerClass);
Map<CallbackType, Method> callbacks = listenerMetadata.getCallbacks();
if (callbacks != null) {
for (Map.Entry<CallbackType, Metho... | java | private void processExternalListener(Class<?> listenerClass) {
ExternalListenerMetadata listenerMetadata = ExternalListenerIntrospector
.introspect(listenerClass);
Map<CallbackType, Method> callbacks = listenerMetadata.getCallbacks();
if (callbacks != null) {
for (Map.Entry<CallbackType, Metho... | [
"private",
"void",
"processExternalListener",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"ExternalListenerMetadata",
"listenerMetadata",
"=",
"ExternalListenerIntrospector",
".",
"introspect",
"(",
"listenerClass",
")",
";",
"Map",
"<",
"CallbackType",
",... | Introspects the given listener class and finds all methods that should receive callback event
notifications.
@param listenerClass
the listener class | [
"Introspects",
"the",
"given",
"listener",
"class",
"and",
"finds",
"all",
"methods",
"that",
"should",
"receive",
"callback",
"event",
"notifications",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L143-L152 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.validateExternalCallback | private void validateExternalCallback(Method method, CallbackType callbackType) {
Class<?>[] parameters = method.getParameterTypes();
if (!parameters[0].isAssignableFrom(entityClass)) {
String message = String.format("Method %s in class %s is not valid for entity %s",
method.getName(), method.ge... | java | private void validateExternalCallback(Method method, CallbackType callbackType) {
Class<?>[] parameters = method.getParameterTypes();
if (!parameters[0].isAssignableFrom(entityClass)) {
String message = String.format("Method %s in class %s is not valid for entity %s",
method.getName(), method.ge... | [
"private",
"void",
"validateExternalCallback",
"(",
"Method",
"method",
",",
"CallbackType",
"callbackType",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameters",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"!",
"parameters",
"[",
... | Validates and registers the given callback method.
@param method
the callback method
@param callbackType
the callback type | [
"Validates",
"and",
"registers",
"the",
"given",
"callback",
"method",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L162-L172 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.processInternalListeners | private void processInternalListeners() {
List<Class<?>> internalListeners = getAllInternalListeners();
for (Class<?> internalListener : internalListeners) {
processInternalListener(internalListener);
}
} | java | private void processInternalListeners() {
List<Class<?>> internalListeners = getAllInternalListeners();
for (Class<?> internalListener : internalListeners) {
processInternalListener(internalListener);
}
} | [
"private",
"void",
"processInternalListeners",
"(",
")",
"{",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"internalListeners",
"=",
"getAllInternalListeners",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"internalListener",
":",
"internalListeners",
")",
... | Introspects the entity class hierarchy for any internal callback methods and updates the
metadata. | [
"Introspects",
"the",
"entity",
"class",
"hierarchy",
"for",
"any",
"internal",
"callback",
"methods",
"and",
"updates",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L178-L183 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.getAllInternalListeners | private List<Class<?>> getAllInternalListeners() {
Class<?> clazz = entityClass;
List<Class<?>> allListeners = new ArrayList<>();
boolean stop = false;
while (!stop) {
allListeners.add(0, clazz);
boolean excludeSuperClassListeners = clazz
.isAnnotationPresent(ExcludeSuperclassListe... | java | private List<Class<?>> getAllInternalListeners() {
Class<?> clazz = entityClass;
List<Class<?>> allListeners = new ArrayList<>();
boolean stop = false;
while (!stop) {
allListeners.add(0, clazz);
boolean excludeSuperClassListeners = clazz
.isAnnotationPresent(ExcludeSuperclassListe... | [
"private",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"getAllInternalListeners",
"(",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"entityClass",
";",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"allListeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")"... | Traverses up the entity class hierarchy and returns the list of all classes that may
potentially have callback listeners.
@return all internal callback listeners | [
"Traverses",
"up",
"the",
"entity",
"class",
"hierarchy",
"and",
"returns",
"the",
"list",
"of",
"all",
"classes",
"that",
"may",
"potentially",
"have",
"callback",
"listeners",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L191-L205 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.processInternalListener | private void processInternalListener(Class<?> listenerClass) {
InternalListenerMetadata listenerMetadata = InternalListenerIntrospector
.introspect(listenerClass);
Map<CallbackType, Method> callbacks = listenerMetadata.getCallbacks();
if (callbacks != null) {
for (Map.Entry<CallbackType, Metho... | java | private void processInternalListener(Class<?> listenerClass) {
InternalListenerMetadata listenerMetadata = InternalListenerIntrospector
.introspect(listenerClass);
Map<CallbackType, Method> callbacks = listenerMetadata.getCallbacks();
if (callbacks != null) {
for (Map.Entry<CallbackType, Metho... | [
"private",
"void",
"processInternalListener",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"InternalListenerMetadata",
"listenerMetadata",
"=",
"InternalListenerIntrospector",
".",
"introspect",
"(",
"listenerClass",
")",
";",
"Map",
"<",
"CallbackType",
",... | Processes the given class and finds any internal callbacks.
@param listenerClass
the class to introspect | [
"Processes",
"the",
"given",
"class",
"and",
"finds",
"any",
"internal",
"callbacks",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L213-L226 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ListenerFactory.java | ListenerFactory.getListener | public Object getListener(Class<?> listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = loadListener(listenerClass);
}
return listener;
} | java | public Object getListener(Class<?> listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = loadListener(listenerClass);
}
return listener;
} | [
"public",
"Object",
"getListener",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"Object",
"listener",
"=",
"listeners",
".",
"get",
"(",
"listenerClass",
")",
";",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"listener",
"=",
"loadListener",
... | Returns the listener object for the given class.
@param listenerClass
the listener class
@return the listener object for the given type | [
"Returns",
"the",
"listener",
"object",
"for",
"the",
"given",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ListenerFactory.java#L55-L61 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ListenerFactory.java | ListenerFactory.loadListener | private Object loadListener(Class<?> listenerClass) {
synchronized (listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = IntrospectionUtils.instantiateObject(listenerClass);
listeners.put(listenerClass, listener);
}
return listen... | java | private Object loadListener(Class<?> listenerClass) {
synchronized (listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = IntrospectionUtils.instantiateObject(listenerClass);
listeners.put(listenerClass, listener);
}
return listen... | [
"private",
"Object",
"loadListener",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"synchronized",
"(",
"listenerClass",
")",
"{",
"Object",
"listener",
"=",
"listeners",
".",
"get",
"(",
"listenerClass",
")",
";",
"if",
"(",
"listener",
"==",
"n... | Instantiates the listener of given type and caches it.
@param listenerClass
the listener type
@return the instantiated object | [
"Instantiates",
"the",
"listener",
"of",
"given",
"type",
"and",
"caches",
"it",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ListenerFactory.java#L79-L88 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java | EmbeddableIntrospector.introspect | public static EmbeddableMetadata introspect(Class<?> embeddableClass) {
EmbeddableIntrospector introspector = new EmbeddableIntrospector(embeddableClass);
introspector.introspect();
return introspector.metadata;
} | java | public static EmbeddableMetadata introspect(Class<?> embeddableClass) {
EmbeddableIntrospector introspector = new EmbeddableIntrospector(embeddableClass);
introspector.introspect();
return introspector.metadata;
} | [
"public",
"static",
"EmbeddableMetadata",
"introspect",
"(",
"Class",
"<",
"?",
">",
"embeddableClass",
")",
"{",
"EmbeddableIntrospector",
"introspector",
"=",
"new",
"EmbeddableIntrospector",
"(",
"embeddableClass",
")",
";",
"introspector",
".",
"introspect",
"(",
... | Introspects the given Embeddable class and returns the metadata.
@param embeddableClass
the Embeddable class
@return the metadata of the given class | [
"Introspects",
"the",
"given",
"Embeddable",
"class",
"and",
"returns",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java#L61-L65 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java | EmbeddableIntrospector.introspect | private void introspect() {
// Make sure the class is Embeddable
if (!embeddableClass.isAnnotationPresent(Embeddable.class)) {
String message = String.format("Class %s must have %s annotation", embeddableClass.getName(),
Embeddable.class.getName());
throw new EntityManagerException(message... | java | private void introspect() {
// Make sure the class is Embeddable
if (!embeddableClass.isAnnotationPresent(Embeddable.class)) {
String message = String.format("Class %s must have %s annotation", embeddableClass.getName(),
Embeddable.class.getName());
throw new EntityManagerException(message... | [
"private",
"void",
"introspect",
"(",
")",
"{",
"// Make sure the class is Embeddable",
"if",
"(",
"!",
"embeddableClass",
".",
"isAnnotationPresent",
"(",
"Embeddable",
".",
"class",
")",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Clas... | Introspects the Embeddable. | [
"Introspects",
"the",
"Embeddable",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java#L70-L79 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java | EmbeddableIntrospector.processFields | private void processFields() {
List<Field> fields = IntrospectionUtils.getPersistableFields(embeddableClass);
for (Field field : fields) {
if (field.isAnnotationPresent(Embedded.class)) {
processEmbeddedField(field);
} else {
processSimpleField(field);
}
}
} | java | private void processFields() {
List<Field> fields = IntrospectionUtils.getPersistableFields(embeddableClass);
for (Field field : fields) {
if (field.isAnnotationPresent(Embedded.class)) {
processEmbeddedField(field);
} else {
processSimpleField(field);
}
}
} | [
"private",
"void",
"processFields",
"(",
")",
"{",
"List",
"<",
"Field",
">",
"fields",
"=",
"IntrospectionUtils",
".",
"getPersistableFields",
"(",
"embeddableClass",
")",
";",
"for",
"(",
"Field",
"field",
":",
"fields",
")",
"{",
"if",
"(",
"field",
"."... | Processes each field in this Embeddable and updates the metadata. | [
"Processes",
"each",
"field",
"in",
"this",
"Embeddable",
"and",
"updates",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddableIntrospector.java#L84-L93 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java | EmbeddedIntrospector.introspect | public static EmbeddedMetadata introspect(EmbeddedField field, EntityMetadata entityMetadata) {
EmbeddedIntrospector introspector = new EmbeddedIntrospector(field, entityMetadata);
introspector.process();
return introspector.metadata;
} | java | public static EmbeddedMetadata introspect(EmbeddedField field, EntityMetadata entityMetadata) {
EmbeddedIntrospector introspector = new EmbeddedIntrospector(field, entityMetadata);
introspector.process();
return introspector.metadata;
} | [
"public",
"static",
"EmbeddedMetadata",
"introspect",
"(",
"EmbeddedField",
"field",
",",
"EntityMetadata",
"entityMetadata",
")",
"{",
"EmbeddedIntrospector",
"introspector",
"=",
"new",
"EmbeddedIntrospector",
"(",
"field",
",",
"entityMetadata",
")",
";",
"introspect... | Introspects the given embedded field and returns its metadata.
@param field
the embedded field to introspect
@param entityMetadata
metadata of the owning entity
@return the metadata of the embedded field | [
"Introspects",
"the",
"given",
"embedded",
"field",
"and",
"returns",
"its",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java#L80-L84 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java | EmbeddedIntrospector.process | private void process() {
metadata = new EmbeddedMetadata(field);
// Make sure the class has @Embeddable annotation
if (!clazz.isAnnotationPresent(Embeddable.class)) {
String message = String.format("Class %s must have %s annotation", clazz.getName(),
Embeddable.class.getName());
throw... | java | private void process() {
metadata = new EmbeddedMetadata(field);
// Make sure the class has @Embeddable annotation
if (!clazz.isAnnotationPresent(Embeddable.class)) {
String message = String.format("Class %s must have %s annotation", clazz.getName(),
Embeddable.class.getName());
throw... | [
"private",
"void",
"process",
"(",
")",
"{",
"metadata",
"=",
"new",
"EmbeddedMetadata",
"(",
"field",
")",
";",
"// Make sure the class has @Embeddable annotation",
"if",
"(",
"!",
"clazz",
".",
"isAnnotationPresent",
"(",
"Embeddable",
".",
"class",
")",
")",
... | Worker class for introspection. | [
"Worker",
"class",
"for",
"introspection",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java#L89-L115 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java | EmbeddedIntrospector.processFields | private void processFields() {
List<Field> children = IntrospectionUtils.getPersistableFields(clazz);
for (Field child : children) {
if (child.isAnnotationPresent(Embedded.class)) {
processEmbeddedField(child);
} else {
processSimpleField(child);
}
}
} | java | private void processFields() {
List<Field> children = IntrospectionUtils.getPersistableFields(clazz);
for (Field child : children) {
if (child.isAnnotationPresent(Embedded.class)) {
processEmbeddedField(child);
} else {
processSimpleField(child);
}
}
} | [
"private",
"void",
"processFields",
"(",
")",
"{",
"List",
"<",
"Field",
">",
"children",
"=",
"IntrospectionUtils",
".",
"getPersistableFields",
"(",
"clazz",
")",
";",
"for",
"(",
"Field",
"child",
":",
"children",
")",
"{",
"if",
"(",
"child",
".",
"i... | Processes each field in this embedded object and updates the metadata. | [
"Processes",
"each",
"field",
"in",
"this",
"embedded",
"object",
"and",
"updates",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java#L120-L129 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java | EmbeddedIntrospector.processPropertyOverride | private void processPropertyOverride(PropertyMetadata propertyMetadata) {
String qualifiedName = field.getQualifiedName() + "." + propertyMetadata.getField().getName();
Property override = entityMetadata.getPropertyOverride(qualifiedName);
if (override != null) {
String mappedName = override.name();
... | java | private void processPropertyOverride(PropertyMetadata propertyMetadata) {
String qualifiedName = field.getQualifiedName() + "." + propertyMetadata.getField().getName();
Property override = entityMetadata.getPropertyOverride(qualifiedName);
if (override != null) {
String mappedName = override.name();
... | [
"private",
"void",
"processPropertyOverride",
"(",
"PropertyMetadata",
"propertyMetadata",
")",
"{",
"String",
"qualifiedName",
"=",
"field",
".",
"getQualifiedName",
"(",
")",
"+",
"\".\"",
"+",
"propertyMetadata",
".",
"getField",
"(",
")",
".",
"getName",
"(",
... | Processes the override, if any, for the given property.
@param propertyMetadata
the metadata of the property | [
"Processes",
"the",
"override",
"if",
"any",
"for",
"the",
"given",
"property",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddedIntrospector.java#L152-L163 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.validateIntent | private void validateIntent() {
if (entityMetadata.isProjectedEntity() && !intent.isValidOnProjectedEntities()) {
String message = String.format("Operation %s is not allowed for ProjectedEntity %s", intent,
entity.getClass().getName());
throw new EntityManagerException(message);
}
} | java | private void validateIntent() {
if (entityMetadata.isProjectedEntity() && !intent.isValidOnProjectedEntities()) {
String message = String.format("Operation %s is not allowed for ProjectedEntity %s", intent,
entity.getClass().getName());
throw new EntityManagerException(message);
}
} | [
"private",
"void",
"validateIntent",
"(",
")",
"{",
"if",
"(",
"entityMetadata",
".",
"isProjectedEntity",
"(",
")",
"&&",
"!",
"intent",
".",
"isValidOnProjectedEntities",
"(",
")",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Operat... | Validates if the Intent is legal for the entity being marshalled.
@throws EntityManagerException
if the Intent is not valid for the entity being marshalled | [
"Validates",
"if",
"the",
"Intent",
"is",
"legal",
"for",
"the",
"entity",
"being",
"marshalled",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L183-L189 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshal | private BaseEntity<?> marshal() {
marshalKey();
if (key instanceof Key) {
entityBuilder = Entity.newBuilder((Key) key);
} else {
entityBuilder = FullEntity.newBuilder(key);
}
marshalFields();
marshalAutoTimestampFields();
if (intent == Intent.UPDATE) {
marshalVersionField()... | java | private BaseEntity<?> marshal() {
marshalKey();
if (key instanceof Key) {
entityBuilder = Entity.newBuilder((Key) key);
} else {
entityBuilder = FullEntity.newBuilder(key);
}
marshalFields();
marshalAutoTimestampFields();
if (intent == Intent.UPDATE) {
marshalVersionField()... | [
"private",
"BaseEntity",
"<",
"?",
">",
"marshal",
"(",
")",
"{",
"marshalKey",
"(",
")",
";",
"if",
"(",
"key",
"instanceof",
"Key",
")",
"{",
"entityBuilder",
"=",
"Entity",
".",
"newBuilder",
"(",
"(",
"Key",
")",
"key",
")",
";",
"}",
"else",
"... | Marshals the given entity and and returns the equivalent Entity needed for the underlying Cloud
Datastore API.
@return A native entity that is equivalent to the POJO being marshalled. The returned value
could either be a FullEntity or Entity. | [
"Marshals",
"the",
"given",
"entity",
"and",
"and",
"returns",
"the",
"equivalent",
"Entity",
"needed",
"for",
"the",
"underlying",
"Cloud",
"Datastore",
"API",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L219-L233 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalKey | public static Key marshalKey(DefaultEntityManager entityManager, Object entity) {
Marshaller marshaller = new Marshaller(entityManager, entity, Intent.DELETE);
marshaller.marshalKey();
return (Key) marshaller.key;
} | java | public static Key marshalKey(DefaultEntityManager entityManager, Object entity) {
Marshaller marshaller = new Marshaller(entityManager, entity, Intent.DELETE);
marshaller.marshalKey();
return (Key) marshaller.key;
} | [
"public",
"static",
"Key",
"marshalKey",
"(",
"DefaultEntityManager",
"entityManager",
",",
"Object",
"entity",
")",
"{",
"Marshaller",
"marshaller",
"=",
"new",
"Marshaller",
"(",
"entityManager",
",",
"entity",
",",
"Intent",
".",
"DELETE",
")",
";",
"marshall... | Extracts the key from the given object, entity, and returns it. The entity must have its ID
set.
@param entityManager
the entity manager.
@param entity
the entity from which key is to be extracted
@return extracted key. | [
"Extracts",
"the",
"key",
"from",
"the",
"given",
"object",
"entity",
"and",
"returns",
"it",
".",
"The",
"entity",
"must",
"have",
"its",
"ID",
"set",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L245-L249 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalKey | private void marshalKey() {
Key parent = null;
ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
if (parentKeyMetadata != null) {
DatastoreKey parentDatastoreKey = (DatastoreKey) getFieldValue(parentKeyMetadata);
if (parentDatastoreKey != null) {
parent = par... | java | private void marshalKey() {
Key parent = null;
ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
if (parentKeyMetadata != null) {
DatastoreKey parentDatastoreKey = (DatastoreKey) getFieldValue(parentKeyMetadata);
if (parentDatastoreKey != null) {
parent = par... | [
"private",
"void",
"marshalKey",
"(",
")",
"{",
"Key",
"parent",
"=",
"null",
";",
"ParentKeyMetadata",
"parentKeyMetadata",
"=",
"entityMetadata",
".",
"getParentKeyMetadata",
"(",
")",
";",
"if",
"(",
"parentKeyMetadata",
"!=",
"null",
")",
"{",
"DatastoreKey"... | Marshals the key. | [
"Marshals",
"the",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L254-L308 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.isValidId | private static boolean isValidId(Object idValue, DataType identifierType) {
boolean validId = false;
if (idValue != null) {
switch (identifierType) {
case LONG:
case LONG_OBJECT:
validId = (long) idValue != 0;
break;
case STRING:
validId = ((String) id... | java | private static boolean isValidId(Object idValue, DataType identifierType) {
boolean validId = false;
if (idValue != null) {
switch (identifierType) {
case LONG:
case LONG_OBJECT:
validId = (long) idValue != 0;
break;
case STRING:
validId = ((String) id... | [
"private",
"static",
"boolean",
"isValidId",
"(",
"Object",
"idValue",
",",
"DataType",
"identifierType",
")",
"{",
"boolean",
"validId",
"=",
"false",
";",
"if",
"(",
"idValue",
"!=",
"null",
")",
"{",
"switch",
"(",
"identifierType",
")",
"{",
"case",
"L... | Checks to see if the given value is a valid identifier for the given ID type.
@param idValue
the ID value
@param identifierType
the identifier type
@return <code>true</code>, if the given value is a valid identifier; <code>false</code>,
otherwise. For STRING type, the ID is valid if it it contains at least one printab... | [
"Checks",
"to",
"see",
"if",
"the",
"given",
"value",
"is",
"a",
"valid",
"identifier",
"for",
"the",
"given",
"ID",
"type",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L322-L339 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.createCompleteKey | private void createCompleteKey(Key parent, long id) {
String kind = entityMetadata.getKind();
if (parent == null) {
key = entityManager.newNativeKeyFactory().setKind(kind).newKey(id);
} else {
key = Key.newBuilder(parent, kind, id).build();
}
} | java | private void createCompleteKey(Key parent, long id) {
String kind = entityMetadata.getKind();
if (parent == null) {
key = entityManager.newNativeKeyFactory().setKind(kind).newKey(id);
} else {
key = Key.newBuilder(parent, kind, id).build();
}
} | [
"private",
"void",
"createCompleteKey",
"(",
"Key",
"parent",
",",
"long",
"id",
")",
"{",
"String",
"kind",
"=",
"entityMetadata",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"key",
"=",
"entityManager",
".",
"newNativeKe... | Creates a complete key using the given parameters.
@param parent
the parent key, may be <code>null</code>.
@param id
the numeric ID | [
"Creates",
"a",
"complete",
"key",
"using",
"the",
"given",
"parameters",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L349-L356 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.createIncompleteKey | private void createIncompleteKey(Key parent) {
String kind = entityMetadata.getKind();
if (parent == null) {
key = entityManager.newNativeKeyFactory().setKind(kind).newKey();
} else {
key = IncompleteKey.newBuilder(parent, kind).build();
}
} | java | private void createIncompleteKey(Key parent) {
String kind = entityMetadata.getKind();
if (parent == null) {
key = entityManager.newNativeKeyFactory().setKind(kind).newKey();
} else {
key = IncompleteKey.newBuilder(parent, kind).build();
}
} | [
"private",
"void",
"createIncompleteKey",
"(",
"Key",
"parent",
")",
"{",
"String",
"kind",
"=",
"entityMetadata",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"key",
"=",
"entityManager",
".",
"newNativeKeyFactory",
"(",
")"... | Creates an IncompleteKey.
@param parent
the parent key, may be <code>null</code>. | [
"Creates",
"an",
"IncompleteKey",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L398-L405 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalFields | private void marshalFields() {
Collection<PropertyMetadata> propertyMetadataCollection = entityMetadata
.getPropertyMetadataCollection();
for (PropertyMetadata propertyMetadata : propertyMetadataCollection) {
marshalField(propertyMetadata, entity);
}
} | java | private void marshalFields() {
Collection<PropertyMetadata> propertyMetadataCollection = entityMetadata
.getPropertyMetadataCollection();
for (PropertyMetadata propertyMetadata : propertyMetadataCollection) {
marshalField(propertyMetadata, entity);
}
} | [
"private",
"void",
"marshalFields",
"(",
")",
"{",
"Collection",
"<",
"PropertyMetadata",
">",
"propertyMetadataCollection",
"=",
"entityMetadata",
".",
"getPropertyMetadataCollection",
"(",
")",
";",
"for",
"(",
"PropertyMetadata",
"propertyMetadata",
":",
"propertyMet... | Marshals all the fields. | [
"Marshals",
"all",
"the",
"fields",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L410-L416 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalField | private static void marshalField(PropertyMetadata propertyMetadata, Object target,
BaseEntity.Builder<?, ?> entityBuilder) {
Object fieldValue = IntrospectionUtils.getFieldValue(propertyMetadata, target);
if (fieldValue == null && propertyMetadata.isOptional()) {
return;
}
ValueBuilder<?, ?,... | java | private static void marshalField(PropertyMetadata propertyMetadata, Object target,
BaseEntity.Builder<?, ?> entityBuilder) {
Object fieldValue = IntrospectionUtils.getFieldValue(propertyMetadata, target);
if (fieldValue == null && propertyMetadata.isOptional()) {
return;
}
ValueBuilder<?, ?,... | [
"private",
"static",
"void",
"marshalField",
"(",
"PropertyMetadata",
"propertyMetadata",
",",
"Object",
"target",
",",
"BaseEntity",
".",
"Builder",
"<",
"?",
",",
"?",
">",
"entityBuilder",
")",
"{",
"Object",
"fieldValue",
"=",
"IntrospectionUtils",
".",
"get... | Marshals the field with the given property metadata.
@param propertyMetadata
the metadata of the field to be marshaled.
@param target
the object in which the field is defined/accessible from
@param entityBuilder
the native entity on which the marshaled field should be set | [
"Marshals",
"the",
"field",
"with",
"the",
"given",
"property",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L440-L458 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalEmbeddedFields | private void marshalEmbeddedFields() {
for (EmbeddedMetadata embeddedMetadata : entityMetadata.getEmbeddedMetadataCollection()) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
marshalWithExplodedStrategy(embeddedMetadata, entity);
} else {
ValueBuilder<?, ?, ?>... | java | private void marshalEmbeddedFields() {
for (EmbeddedMetadata embeddedMetadata : entityMetadata.getEmbeddedMetadataCollection()) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
marshalWithExplodedStrategy(embeddedMetadata, entity);
} else {
ValueBuilder<?, ?, ?>... | [
"private",
"void",
"marshalEmbeddedFields",
"(",
")",
"{",
"for",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
":",
"entityMetadata",
".",
"getEmbeddedMetadataCollection",
"(",
")",
")",
"{",
"if",
"(",
"embeddedMetadata",
".",
"getStorageStrategy",
"(",
")",
"==",
... | Marshals the embedded fields. | [
"Marshals",
"the",
"embedded",
"fields",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L474-L487 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalWithExplodedStrategy | private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, emb... | java | private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, emb... | [
"private",
"void",
"marshalWithExplodedStrategy",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"Object",
"embeddedObject",
"=",
"initializeEmbedded",
"(",
"embeddedMetadata",
",",
"target",
")",
";",
"for",
"(",
"Proper... | Marshals an embedded field represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field
@param target
the target object to which the embedded object belongs | [
"Marshals",
"an",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L497-L509 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalWithImplodedStrategy | private ValueBuilder<?, ?, ?> marshalWithImplodedStrategy(EmbeddedMetadata embeddedMetadata,
Object target) {
try {
Object embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
if (embeddedObject == null) {
if (embeddedMetadata.isOptional()) {
return null;
}
... | java | private ValueBuilder<?, ?, ?> marshalWithImplodedStrategy(EmbeddedMetadata embeddedMetadata,
Object target) {
try {
Object embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
if (embeddedObject == null) {
if (embeddedMetadata.isOptional()) {
return null;
}
... | [
"private",
"ValueBuilder",
"<",
"?",
",",
"?",
",",
"?",
">",
"marshalWithImplodedStrategy",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"Object",
"embeddedObject",
"=",
"embeddedMetadata",
".",
"getReadMethod",
"(",... | Marshals the embedded field represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field.
@param target
the object in which the embedded field is defined/accessible from.
@return the ValueBuilder equivalent to embedded object | [
"Marshals",
"the",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L520-L552 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalUpdatedTimestamp | private void marshalUpdatedTimestamp() {
PropertyMetadata updatedTimestampMetadata = entityMetadata.getUpdatedTimestampMetadata();
if (updatedTimestampMetadata != null) {
applyAutoTimestamp(updatedTimestampMetadata, System.currentTimeMillis());
}
} | java | private void marshalUpdatedTimestamp() {
PropertyMetadata updatedTimestampMetadata = entityMetadata.getUpdatedTimestampMetadata();
if (updatedTimestampMetadata != null) {
applyAutoTimestamp(updatedTimestampMetadata, System.currentTimeMillis());
}
} | [
"private",
"void",
"marshalUpdatedTimestamp",
"(",
")",
"{",
"PropertyMetadata",
"updatedTimestampMetadata",
"=",
"entityMetadata",
".",
"getUpdatedTimestampMetadata",
"(",
")",
";",
"if",
"(",
"updatedTimestampMetadata",
"!=",
"null",
")",
"{",
"applyAutoTimestamp",
"(... | Marshals the updated timestamp field. | [
"Marshals",
"the",
"updated",
"timestamp",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L575-L580 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalCreatedAndUpdatedTimestamp | private void marshalCreatedAndUpdatedTimestamp() {
PropertyMetadata createdTimestampMetadata = entityMetadata.getCreatedTimestampMetadata();
PropertyMetadata updatedTimestampMetadata = entityMetadata.getUpdatedTimestampMetadata();
long millis = System.currentTimeMillis();
if (createdTimestampMetadata !=... | java | private void marshalCreatedAndUpdatedTimestamp() {
PropertyMetadata createdTimestampMetadata = entityMetadata.getCreatedTimestampMetadata();
PropertyMetadata updatedTimestampMetadata = entityMetadata.getUpdatedTimestampMetadata();
long millis = System.currentTimeMillis();
if (createdTimestampMetadata !=... | [
"private",
"void",
"marshalCreatedAndUpdatedTimestamp",
"(",
")",
"{",
"PropertyMetadata",
"createdTimestampMetadata",
"=",
"entityMetadata",
".",
"getCreatedTimestampMetadata",
"(",
")",
";",
"PropertyMetadata",
"updatedTimestampMetadata",
"=",
"entityMetadata",
".",
"getUpd... | Marshals both created and updated timestamp fields. | [
"Marshals",
"both",
"created",
"and",
"updated",
"timestamp",
"fields",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L585-L595 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalVersionField | private void marshalVersionField() {
PropertyMetadata versionMetadata = entityMetadata.getVersionMetadata();
if (versionMetadata != null) {
long version = (long) IntrospectionUtils.getFieldValue(versionMetadata, entity);
ValueBuilder<?, ?, ?> valueBuilder = versionMetadata.getMapper().toDatastore(ve... | java | private void marshalVersionField() {
PropertyMetadata versionMetadata = entityMetadata.getVersionMetadata();
if (versionMetadata != null) {
long version = (long) IntrospectionUtils.getFieldValue(versionMetadata, entity);
ValueBuilder<?, ?, ?> valueBuilder = versionMetadata.getMapper().toDatastore(ve... | [
"private",
"void",
"marshalVersionField",
"(",
")",
"{",
"PropertyMetadata",
"versionMetadata",
"=",
"entityMetadata",
".",
"getVersionMetadata",
"(",
")",
";",
"if",
"(",
"versionMetadata",
"!=",
"null",
")",
"{",
"long",
"version",
"=",
"(",
"long",
")",
"In... | Marshals the version field, if it exists. The version will be set to one more than the previous
value. | [
"Marshals",
"the",
"version",
"field",
"if",
"it",
"exists",
".",
"The",
"version",
"will",
"be",
"set",
"to",
"one",
"more",
"than",
"the",
"previous",
"value",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L629-L637 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/mappers/ListMapper.java | ListMapper.initializeMapper | private void initializeMapper() {
if (itemClass == null) {
itemMapper = CatchAllMapper.getInstance();
} else {
try {
itemMapper = MapperFactory.getInstance().getMapper(itemClass);
} catch (NoSuitableMapperException exp) {
itemMapper = CatchAllMapper.getInstance();
}
}... | java | private void initializeMapper() {
if (itemClass == null) {
itemMapper = CatchAllMapper.getInstance();
} else {
try {
itemMapper = MapperFactory.getInstance().getMapper(itemClass);
} catch (NoSuitableMapperException exp) {
itemMapper = CatchAllMapper.getInstance();
}
}... | [
"private",
"void",
"initializeMapper",
"(",
")",
"{",
"if",
"(",
"itemClass",
"==",
"null",
")",
"{",
"itemMapper",
"=",
"CatchAllMapper",
".",
"getInstance",
"(",
")",
";",
"}",
"else",
"{",
"try",
"{",
"itemMapper",
"=",
"MapperFactory",
".",
"getInstanc... | Initializes the mapper for items in the List. | [
"Initializes",
"the",
"mapper",
"for",
"items",
"in",
"the",
"List",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/mappers/ListMapper.java#L87-L97 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/ConnectionParameters.java | ConnectionParameters.setJsonCredentialsFile | public void setJsonCredentialsFile(String jsonCredentialsPath) {
if (!Utility.isNullOrEmpty(jsonCredentialsPath)) {
setJsonCredentialsFile(new File(jsonCredentialsPath));
} else {
setJsonCredentialsFile((File) null);
}
} | java | public void setJsonCredentialsFile(String jsonCredentialsPath) {
if (!Utility.isNullOrEmpty(jsonCredentialsPath)) {
setJsonCredentialsFile(new File(jsonCredentialsPath));
} else {
setJsonCredentialsFile((File) null);
}
} | [
"public",
"void",
"setJsonCredentialsFile",
"(",
"String",
"jsonCredentialsPath",
")",
"{",
"if",
"(",
"!",
"Utility",
".",
"isNullOrEmpty",
"(",
"jsonCredentialsPath",
")",
")",
"{",
"setJsonCredentialsFile",
"(",
"new",
"File",
"(",
"jsonCredentialsPath",
")",
"... | Sets the JSON credentials path.
@param jsonCredentialsPath
the JSON credentials path. | [
"Sets",
"the",
"JSON",
"credentials",
"path",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/ConnectionParameters.java#L205-L211 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/mappers/MapMapper.java | MapMapper.initializeMapper | private void initializeMapper() {
if (valueClass == null) {
valueMapper = CatchAllMapper.getInstance();
} else {
try {
valueMapper = MapperFactory.getInstance().getMapper(valueClass);
} catch (NoSuitableMapperException exp) {
valueMapper = CatchAllMapper.getInstance();
}
... | java | private void initializeMapper() {
if (valueClass == null) {
valueMapper = CatchAllMapper.getInstance();
} else {
try {
valueMapper = MapperFactory.getInstance().getMapper(valueClass);
} catch (NoSuitableMapperException exp) {
valueMapper = CatchAllMapper.getInstance();
}
... | [
"private",
"void",
"initializeMapper",
"(",
")",
"{",
"if",
"(",
"valueClass",
"==",
"null",
")",
"{",
"valueMapper",
"=",
"CatchAllMapper",
".",
"getInstance",
"(",
")",
";",
"}",
"else",
"{",
"try",
"{",
"valueMapper",
"=",
"MapperFactory",
".",
"getInst... | Initializes the mapper for values in the Map. | [
"Initializes",
"the",
"mapper",
"for",
"values",
"in",
"the",
"Map",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/mappers/MapMapper.java#L96-L107 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java | InternalListenerIntrospector.introspect | public static InternalListenerMetadata introspect(Class<?> listenerClass) {
InternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMet... | java | public static InternalListenerMetadata introspect(Class<?> listenerClass) {
InternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMet... | [
"public",
"static",
"InternalListenerMetadata",
"introspect",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"InternalListenerMetadata",
"cachedMetadata",
"=",
"cache",
".",
"get",
"(",
"listenerClass",
")",
";",
"if",
"(",
"cachedMetadata",
"!=",
"null",... | Introspects the given class for any defined listeners and returns the metadata.
@param listenerClass
the entity listener class
@return the entity listener metadata | [
"Introspects",
"the",
"given",
"class",
"for",
"any",
"defined",
"listeners",
"and",
"returns",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java#L64-L79 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java | InternalListenerIntrospector.processMethods | private void processMethods() {
Method[] methods = listenerClass.getDeclaredMethods();
for (Method method : methods) {
for (CallbackType callbackType : CallbackType.values()) {
if (method.isAnnotationPresent(callbackType.getAnnotationClass())) {
validateMethod(method, callbackType);
... | java | private void processMethods() {
Method[] methods = listenerClass.getDeclaredMethods();
for (Method method : methods) {
for (CallbackType callbackType : CallbackType.values()) {
if (method.isAnnotationPresent(callbackType.getAnnotationClass())) {
validateMethod(method, callbackType);
... | [
"private",
"void",
"processMethods",
"(",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"listenerClass",
".",
"getDeclaredMethods",
"(",
")",
";",
"for",
"(",
"Method",
"method",
":",
"methods",
")",
"{",
"for",
"(",
"CallbackType",
"callbackType",
":",
"C... | Processes the methods in the listener class and updates the metadata for any valid methods
found. | [
"Processes",
"the",
"methods",
"in",
"the",
"listener",
"class",
"and",
"updates",
"the",
"metadata",
"for",
"any",
"valid",
"methods",
"found",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java#L93-L103 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java | InternalListenerIntrospector.validateMethod | private void validateMethod(Method method, CallbackType callbackType) {
int modifiers = method.getModifiers();
if (!Modifier.isPublic(modifiers)) {
String message = String.format("Method %s in class %s must be public", method.getName(),
method.getDeclaringClass().getName());
throw new Enti... | java | private void validateMethod(Method method, CallbackType callbackType) {
int modifiers = method.getModifiers();
if (!Modifier.isPublic(modifiers)) {
String message = String.format("Method %s in class %s must be public", method.getName(),
method.getDeclaringClass().getName());
throw new Enti... | [
"private",
"void",
"validateMethod",
"(",
"Method",
"method",
",",
"CallbackType",
"callbackType",
")",
"{",
"int",
"modifiers",
"=",
"method",
".",
"getModifiers",
"(",
")",
";",
"if",
"(",
"!",
"Modifier",
".",
"isPublic",
"(",
"modifiers",
")",
")",
"{"... | Validates the given method to ensure if it is a valid callback method for the given event type.
@param method
the method to validate
@param callbackType
the callback type | [
"Validates",
"the",
"given",
"method",
"to",
"ensure",
"if",
"it",
"is",
"a",
"valid",
"callback",
"method",
"for",
"the",
"given",
"event",
"type",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/InternalListenerIntrospector.java#L113-L143 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.insert | public <E> E insert(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_INSERT, entity);
FullEntity<?> nativeEntity = (FullEntity<?>) Marshaller.marshal(entityManager, entity,
Intent.INSERT);
Entity insertedNativeEntity = nativeWriter.add(nativeEntity);
@Suppres... | java | public <E> E insert(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_INSERT, entity);
FullEntity<?> nativeEntity = (FullEntity<?>) Marshaller.marshal(entityManager, entity,
Intent.INSERT);
Entity insertedNativeEntity = nativeWriter.add(nativeEntity);
@Suppres... | [
"public",
"<",
"E",
">",
"E",
"insert",
"(",
"E",
"entity",
")",
"{",
"try",
"{",
"entityManager",
".",
"executeEntityListeners",
"(",
"CallbackType",
".",
"PRE_INSERT",
",",
"entity",
")",
";",
"FullEntity",
"<",
"?",
">",
"nativeEntity",
"=",
"(",
"Ful... | Inserts the given entity into the Cloud Datastore.
@param entity
the entity to insert
@return the inserted entity. The inserted entity will not be same as the passed in entity. For
example, the inserted entity may contain any generated ID, key, parent key, etc.
@throws EntityManagerException
if any error occurs while ... | [
"Inserts",
"the",
"given",
"entity",
"into",
"the",
"Cloud",
"Datastore",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L110-L123 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.insert | @SuppressWarnings("unchecked")
public <E> List<E> insert(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
entityManager.executeEntityListeners(CallbackType.PRE_INSERT, entities);
FullEntity<?>[] nativeEntities = toNativeFullEntities(enti... | java | @SuppressWarnings("unchecked")
public <E> List<E> insert(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
entityManager.executeEntityListeners(CallbackType.PRE_INSERT, entities);
FullEntity<?>[] nativeEntities = toNativeFullEntities(enti... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"insert",
"(",
"List",
"<",
"E",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
"||",
"entities",
".",
"isEmpty",
"(",
")",
")",
"{... | Inserts the given list of entities into the Cloud Datastore.
@param entities
the entities to insert.
@return the inserted entities. The inserted entities will not be same as the passed in
entities. For example, the inserted entities may contain generated ID, key, parent key,
etc.
@throws EntityManagerException
if any ... | [
"Inserts",
"the",
"given",
"list",
"of",
"entities",
"into",
"the",
"Cloud",
"Datastore",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L136-L152 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.update | @SuppressWarnings("unchecked")
public <E> E update(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Intent intent = (nativeWriter instanceof Batch) ? Intent.BATCH_UPDATE : Intent.UPDATE;
Entity nativeEntity = (Entity) Marshaller.marshal(entityManager, enti... | java | @SuppressWarnings("unchecked")
public <E> E update(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Intent intent = (nativeWriter instanceof Batch) ? Intent.BATCH_UPDATE : Intent.UPDATE;
Entity nativeEntity = (Entity) Marshaller.marshal(entityManager, enti... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"E",
"update",
"(",
"E",
"entity",
")",
"{",
"try",
"{",
"entityManager",
".",
"executeEntityListeners",
"(",
"CallbackType",
".",
"PRE_UPDATE",
",",
"entity",
")",
";",
"Intent",
... | Updates the given entity in the Cloud Datastore. The passed in Entity must have its ID set for
the update to work.
@param entity
the entity to update
@return the updated entity.
@throws EntityManagerException
if any error occurs while updating. | [
"Updates",
"the",
"given",
"entity",
"in",
"the",
"Cloud",
"Datastore",
".",
"The",
"passed",
"in",
"Entity",
"must",
"have",
"its",
"ID",
"set",
"for",
"the",
"update",
"to",
"work",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L164-L178 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.update | @SuppressWarnings("unchecked")
public <E> List<E> update(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
Class<E> entityClass = (Class<E>) entities.get(0).getClass();
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entitie... | java | @SuppressWarnings("unchecked")
public <E> List<E> update(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
Class<E> entityClass = (Class<E>) entities.get(0).getClass();
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entitie... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"update",
"(",
"List",
"<",
"E",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
"||",
"entities",
".",
"isEmpty",
"(",
")",
")",
"{... | Updates the given list of entities in the Cloud Datastore.
@param entities
the entities to update. The passed in entities must have their ID set for the update
to work.
@return the updated entities
@throws EntityManagerException
if any error occurs while inserting. | [
"Updates",
"the",
"given",
"list",
"of",
"entities",
"in",
"the",
"Cloud",
"Datastore",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L190-L207 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLock | public <E> E updateWithOptimisticLock(E entity) {
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | java | public <E> E updateWithOptimisticLock(E entity) {
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | [
"public",
"<",
"E",
">",
"E",
"updateWithOptimisticLock",
"(",
"E",
"entity",
")",
"{",
"PropertyMetadata",
"versionMetadata",
"=",
"EntityIntrospector",
".",
"getVersionMetadata",
"(",
"entity",
")",
";",
"if",
"(",
"versionMetadata",
"==",
"null",
")",
"{",
... | Updates the given entity with optimistic locking, if the entity is set up to support optimistic
locking. Otherwise, a normal update is performed.
@param entity
the entity to update
@return the updated entity which may be different than the given entity. | [
"Updates",
"the",
"given",
"entity",
"with",
"optimistic",
"locking",
"if",
"the",
"entity",
"is",
"set",
"up",
"to",
"support",
"optimistic",
"locking",
".",
"Otherwise",
"a",
"normal",
"update",
"is",
"performed",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L217-L225 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLock | public <E> List<E> updateWithOptimisticLock(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
Class<?> entityClass = entities.get(0).getClass();
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entityClass);
if (versionMetadat... | java | public <E> List<E> updateWithOptimisticLock(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
Class<?> entityClass = entities.get(0).getClass();
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entityClass);
if (versionMetadat... | [
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"updateWithOptimisticLock",
"(",
"List",
"<",
"E",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
"||",
"entities",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>... | Updates the given list of entities using optimistic locking feature, if the entities are set up
to support optimistic locking. Otherwise, a normal update is performed.
@param entities
the entities to update
@return the updated entities | [
"Updates",
"the",
"given",
"list",
"of",
"entities",
"using",
"optimistic",
"locking",
"feature",
"if",
"the",
"entities",
"are",
"set",
"up",
"to",
"support",
"optimistic",
"locking",
".",
"Otherwise",
"a",
"normal",
"update",
"is",
"performed",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L235-L246 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLockingInternal | @SuppressWarnings("unchecked")
protected <E> E updateWithOptimisticLockingInternal(E entity, PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Entity nativeEntity = (Entity) Marshaller.marshal(entityMana... | java | @SuppressWarnings("unchecked")
protected <E> E updateWithOptimisticLockingInternal(E entity, PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Entity nativeEntity = (Entity) Marshaller.marshal(entityMana... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"E",
">",
"E",
"updateWithOptimisticLockingInternal",
"(",
"E",
"entity",
",",
"PropertyMetadata",
"versionMetadata",
")",
"{",
"Transaction",
"transaction",
"=",
"null",
";",
"try",
"{",
"entit... | Worker method for updating the given entity with optimistic locking.
@param entity
the entity to update
@param versionMetadata
the metadata for optimistic locking
@return the updated entity | [
"Worker",
"method",
"for",
"updating",
"the",
"given",
"entity",
"with",
"optimistic",
"locking",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L257-L286 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLockInternal | @SuppressWarnings("unchecked")
protected <E> List<E> updateWithOptimisticLockInternal(List<E> entities,
PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entities);
Entity[] nativeEntities = toNativeEntitie... | java | @SuppressWarnings("unchecked")
protected <E> List<E> updateWithOptimisticLockInternal(List<E> entities,
PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entities);
Entity[] nativeEntities = toNativeEntitie... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"E",
">",
"List",
"<",
"E",
">",
"updateWithOptimisticLockInternal",
"(",
"List",
"<",
"E",
">",
"entities",
",",
"PropertyMetadata",
"versionMetadata",
")",
"{",
"Transaction",
"transaction",
... | Internal worker method for updating the entities using optimistic locking.
@param entities
the entities to update
@param versionMetadata
the metadata of the version property
@return the updated entities | [
"Internal",
"worker",
"method",
"for",
"updating",
"the",
"entities",
"using",
"optimistic",
"locking",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L297-L339 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.upsert | public <E> E upsert(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPSERT, entity);
FullEntity<?> nativeEntity = (FullEntity<?>) Marshaller.marshal(entityManager, entity,
Intent.UPSERT);
Entity upsertedNativeEntity = nativeWriter.put(nativeEntity);
@Suppres... | java | public <E> E upsert(E entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPSERT, entity);
FullEntity<?> nativeEntity = (FullEntity<?>) Marshaller.marshal(entityManager, entity,
Intent.UPSERT);
Entity upsertedNativeEntity = nativeWriter.put(nativeEntity);
@Suppres... | [
"public",
"<",
"E",
">",
"E",
"upsert",
"(",
"E",
"entity",
")",
"{",
"try",
"{",
"entityManager",
".",
"executeEntityListeners",
"(",
"CallbackType",
".",
"PRE_UPSERT",
",",
"entity",
")",
";",
"FullEntity",
"<",
"?",
">",
"nativeEntity",
"=",
"(",
"Ful... | Updates or inserts the given entity in the Cloud Datastore. If the entity does not have an ID,
it may be generated.
@param entity
the entity to update or insert
@return the updated/inserted entity.
@throws EntityManagerException
if any error occurs while saving. | [
"Updates",
"or",
"inserts",
"the",
"given",
"entity",
"in",
"the",
"Cloud",
"Datastore",
".",
"If",
"the",
"entity",
"does",
"not",
"have",
"an",
"ID",
"it",
"may",
"be",
"generated",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L351-L364 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.upsert | @SuppressWarnings("unchecked")
public <E> List<E> upsert(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPSERT, entities);
FullEntity<?>[] nativeEntities = toNativeFullEntities(enti... | java | @SuppressWarnings("unchecked")
public <E> List<E> upsert(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPSERT, entities);
FullEntity<?>[] nativeEntities = toNativeFullEntities(enti... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"upsert",
"(",
"List",
"<",
"E",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
"||",
"entities",
".",
"isEmpty",
"(",
")",
")",
"{... | Updates or inserts the given list of entities in the Cloud Datastore. If the entities do not
have a valid ID, IDs may be generated.
@param entities
the entities to update/or insert.
@return the updated or inserted entities
@throws EntityManagerException
if any error occurs while saving. | [
"Updates",
"or",
"inserts",
"the",
"given",
"list",
"of",
"entities",
"in",
"the",
"Cloud",
"Datastore",
".",
"If",
"the",
"entities",
"do",
"not",
"have",
"a",
"valid",
"ID",
"IDs",
"may",
"be",
"generated",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L376-L392 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.delete | public void delete(Object entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entity);
Key nativeKey = Marshaller.marshalKey(entityManager, entity);
nativeWriter.delete(nativeKey);
entityManager.executeEntityListeners(CallbackType.POST_DELETE, entity);
} catch (... | java | public void delete(Object entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entity);
Key nativeKey = Marshaller.marshalKey(entityManager, entity);
nativeWriter.delete(nativeKey);
entityManager.executeEntityListeners(CallbackType.POST_DELETE, entity);
} catch (... | [
"public",
"void",
"delete",
"(",
"Object",
"entity",
")",
"{",
"try",
"{",
"entityManager",
".",
"executeEntityListeners",
"(",
"CallbackType",
".",
"PRE_DELETE",
",",
"entity",
")",
";",
"Key",
"nativeKey",
"=",
"Marshaller",
".",
"marshalKey",
"(",
"entityMa... | Deletes the given entity from the Cloud Datastore.
@param entity
the entity to delete. The entity must have it ID set for the deletion to succeed.
@throws EntityManagerException
if any error occurs while deleting. | [
"Deletes",
"the",
"given",
"entity",
"from",
"the",
"Cloud",
"Datastore",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L402-L411 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.delete | public void delete(List<?> entities) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entities);
Key[] nativeKeys = new Key[entities.size()];
for (int i = 0; i < entities.size(); i++) {
nativeKeys[i] = Marshaller.marshalKey(entityManager, entities.get(i));
}
... | java | public void delete(List<?> entities) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entities);
Key[] nativeKeys = new Key[entities.size()];
for (int i = 0; i < entities.size(); i++) {
nativeKeys[i] = Marshaller.marshalKey(entityManager, entities.get(i));
}
... | [
"public",
"void",
"delete",
"(",
"List",
"<",
"?",
">",
"entities",
")",
"{",
"try",
"{",
"entityManager",
".",
"executeEntityListeners",
"(",
"CallbackType",
".",
"PRE_DELETE",
",",
"entities",
")",
";",
"Key",
"[",
"]",
"nativeKeys",
"=",
"new",
"Key",
... | Deletes the given entities from the Cloud Datastore.
@param entities
the entities to delete. The entities must have it ID set for the deletion to succeed.
@throws EntityManagerException
if any error occurs while deleting. | [
"Deletes",
"the",
"given",
"entities",
"from",
"the",
"Cloud",
"Datastore",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L421-L433 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.delete | public <E> void delete(Class<E> entityClass, DatastoreKey parentKey, long id) {
try {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key nativeKey = Key.newBuilder(parentKey.nativeKey(), entityMetadata.getKind(), id).build();
nativeWriter.delete(nativeKey);
} catch... | java | public <E> void delete(Class<E> entityClass, DatastoreKey parentKey, long id) {
try {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key nativeKey = Key.newBuilder(parentKey.nativeKey(), entityMetadata.getKind(), id).build();
nativeWriter.delete(nativeKey);
} catch... | [
"public",
"<",
"E",
">",
"void",
"delete",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"DatastoreKey",
"parentKey",
",",
"long",
"id",
")",
"{",
"try",
"{",
"EntityMetadata",
"entityMetadata",
"=",
"EntityIntrospector",
".",
"introspect",
"(",
"entityCl... | Deletes the entity with the given ID and parent key.
@param entityClass
the entity class.
@param parentKey
the parent key
@param id
the ID of the entity.
@throws EntityManagerException
if any error occurs while inserting. | [
"Deletes",
"the",
"entity",
"with",
"the",
"given",
"ID",
"and",
"parent",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L491-L499 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.deleteByKey | public void deleteByKey(DatastoreKey key) {
try {
nativeWriter.delete(key.nativeKey());
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
}
} | java | public void deleteByKey(DatastoreKey key) {
try {
nativeWriter.delete(key.nativeKey());
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
}
} | [
"public",
"void",
"deleteByKey",
"(",
"DatastoreKey",
"key",
")",
"{",
"try",
"{",
"nativeWriter",
".",
"delete",
"(",
"key",
".",
"nativeKey",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DatastoreException",
"exp",
")",
"{",
"throw",
"DatastoreUtils",
".",
... | Deletes an entity given its key.
@param key
the entity's key
@throws EntityManagerException
if any error occurs while deleting. | [
"Deletes",
"an",
"entity",
"given",
"its",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L531-L537 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.deleteByKey | public void deleteByKey(List<DatastoreKey> keys) {
try {
Key[] nativeKeys = new Key[keys.size()];
for (int i = 0; i < keys.size(); i++) {
nativeKeys[i] = keys.get(i).nativeKey();
}
nativeWriter.delete(nativeKeys);
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap... | java | public void deleteByKey(List<DatastoreKey> keys) {
try {
Key[] nativeKeys = new Key[keys.size()];
for (int i = 0; i < keys.size(); i++) {
nativeKeys[i] = keys.get(i).nativeKey();
}
nativeWriter.delete(nativeKeys);
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap... | [
"public",
"void",
"deleteByKey",
"(",
"List",
"<",
"DatastoreKey",
">",
"keys",
")",
"{",
"try",
"{",
"Key",
"[",
"]",
"nativeKeys",
"=",
"new",
"Key",
"[",
"keys",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<... | Deletes the entities having the given keys.
@param keys
the entities' keys
@throws EntityManagerException
if any error occurs while deleting. | [
"Deletes",
"the",
"entities",
"having",
"the",
"given",
"keys",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L547-L557 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java | BaseQueryRequest.setNamedBindings | public void setNamedBindings(Map<String, Object> namedBindings) {
if (namedBindings == null) {
throw new IllegalArgumentException("namedBindings cannot be null");
}
this.namedBindings = namedBindings;
} | java | public void setNamedBindings(Map<String, Object> namedBindings) {
if (namedBindings == null) {
throw new IllegalArgumentException("namedBindings cannot be null");
}
this.namedBindings = namedBindings;
} | [
"public",
"void",
"setNamedBindings",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"namedBindings",
")",
"{",
"if",
"(",
"namedBindings",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"namedBindings cannot be null\"",
")",
";",
"}"... | Sets the named bindings that are needed for any named parameters in the GQL query.
@param namedBindings
the named bindings.
@throws NullPointerException
if the <code>namedBindings</code> argument is <code>null</code>. | [
"Sets",
"the",
"named",
"bindings",
"that",
"are",
"needed",
"for",
"any",
"named",
"parameters",
"in",
"the",
"GQL",
"query",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java#L95-L100 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java | BaseQueryRequest.addPositionalBindings | public void addPositionalBindings(Object first, Object... others) {
positionalBindings.add(first);
positionalBindings.addAll(Arrays.asList(others));
} | java | public void addPositionalBindings(Object first, Object... others) {
positionalBindings.add(first);
positionalBindings.addAll(Arrays.asList(others));
} | [
"public",
"void",
"addPositionalBindings",
"(",
"Object",
"first",
",",
"Object",
"...",
"others",
")",
"{",
"positionalBindings",
".",
"add",
"(",
"first",
")",
";",
"positionalBindings",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"others",
")",
")",... | Adds the positional bindings that are needed for any positional parameters in the GQL query.
@param first
the first positional binding
@param others
subsequent positional bindings, if any | [
"Adds",
"the",
"positional",
"bindings",
"that",
"are",
"needed",
"for",
"any",
"positional",
"parameters",
"in",
"the",
"GQL",
"query",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java#L152-L155 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EmbeddedField.java | EmbeddedField.computeQualifiedName | private void computeQualifiedName() {
if (parent != null) {
qualifiedName = parent.qualifiedName + "." + field.getName();
} else {
qualifiedName = field.getName();
}
} | java | private void computeQualifiedName() {
if (parent != null) {
qualifiedName = parent.qualifiedName + "." + field.getName();
} else {
qualifiedName = field.getName();
}
} | [
"private",
"void",
"computeQualifiedName",
"(",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"qualifiedName",
"=",
"parent",
".",
"qualifiedName",
"+",
"\".\"",
"+",
"field",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"qualifiedName",
"="... | Computes and sets the qualified name of this field. | [
"Computes",
"and",
"sets",
"the",
"qualified",
"name",
"of",
"this",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EmbeddedField.java#L128-L134 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersMetadata.java | EntityListenersMetadata.put | public void put(CallbackType callbackType, CallbackMetadata callbackMetadata) {
if (callbacks == null) {
callbacks = new EnumMap<>(CallbackType.class);
}
List<CallbackMetadata> callbackMetadataList = callbacks.get(callbackType);
if (callbackMetadataList == null) {
callbackMetadataList = new ... | java | public void put(CallbackType callbackType, CallbackMetadata callbackMetadata) {
if (callbacks == null) {
callbacks = new EnumMap<>(CallbackType.class);
}
List<CallbackMetadata> callbackMetadataList = callbacks.get(callbackType);
if (callbackMetadataList == null) {
callbackMetadataList = new ... | [
"public",
"void",
"put",
"(",
"CallbackType",
"callbackType",
",",
"CallbackMetadata",
"callbackMetadata",
")",
"{",
"if",
"(",
"callbacks",
"==",
"null",
")",
"{",
"callbacks",
"=",
"new",
"EnumMap",
"<>",
"(",
"CallbackType",
".",
"class",
")",
";",
"}",
... | Adds the given CallbackEventMetadata.
@param callbackType
the callback type
@param callbackMetadata
the metadata of the callback | [
"Adds",
"the",
"given",
"CallbackEventMetadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersMetadata.java#L122-L132 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersMetadata.java | EntityListenersMetadata.getCallbacks | public List<CallbackMetadata> getCallbacks(CallbackType callbackType) {
return callbacks == null ? null : callbacks.get(callbackType);
} | java | public List<CallbackMetadata> getCallbacks(CallbackType callbackType) {
return callbacks == null ? null : callbacks.get(callbackType);
} | [
"public",
"List",
"<",
"CallbackMetadata",
">",
"getCallbacks",
"(",
"CallbackType",
"callbackType",
")",
"{",
"return",
"callbacks",
"==",
"null",
"?",
"null",
":",
"callbacks",
".",
"get",
"(",
"callbackType",
")",
";",
"}"
] | Returns the callbacks for the given callback type.
@param callbackType
the callback type
@return the list of callbacks for the given callback type | [
"Returns",
"the",
"callbacks",
"for",
"the",
"given",
"callback",
"type",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersMetadata.java#L141-L143 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java | ConstructorIntrospector.loadMetadata | private static ConstructorMetadata loadMetadata(Class<?> clazz) {
synchronized (clazz) {
ConstructorMetadata metadata = cache.get(clazz);
if (metadata == null) {
ConstructorIntrospector introspector = new ConstructorIntrospector(clazz);
introspector.process();
metadata = introspe... | java | private static ConstructorMetadata loadMetadata(Class<?> clazz) {
synchronized (clazz) {
ConstructorMetadata metadata = cache.get(clazz);
if (metadata == null) {
ConstructorIntrospector introspector = new ConstructorIntrospector(clazz);
introspector.process();
metadata = introspe... | [
"private",
"static",
"ConstructorMetadata",
"loadMetadata",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"synchronized",
"(",
"clazz",
")",
"{",
"ConstructorMetadata",
"metadata",
"=",
"cache",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"metadata",
... | Loads the metadata, if it does not already exist in the cache.
@param clazz
the class to introspect
@return the metadata | [
"Loads",
"the",
"metadata",
"if",
"it",
"does",
"not",
"already",
"exist",
"in",
"the",
"cache",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java#L101-L112 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java | ConstructorIntrospector.process | private void process() {
metadataBuilder = ConstructorMetadata.newBuilder().setClazz(clazz);
MethodHandle mh = IntrospectionUtils.findDefaultConstructor(clazz);
if (mh != null) {
metadataBuilder.setConstructionStrategy(ConstructorMetadata.ConstructionStrategy.CLASSIC)
.setConstructorMethodHa... | java | private void process() {
metadataBuilder = ConstructorMetadata.newBuilder().setClazz(clazz);
MethodHandle mh = IntrospectionUtils.findDefaultConstructor(clazz);
if (mh != null) {
metadataBuilder.setConstructionStrategy(ConstructorMetadata.ConstructionStrategy.CLASSIC)
.setConstructorMethodHa... | [
"private",
"void",
"process",
"(",
")",
"{",
"metadataBuilder",
"=",
"ConstructorMetadata",
".",
"newBuilder",
"(",
")",
".",
"setClazz",
"(",
"clazz",
")",
";",
"MethodHandle",
"mh",
"=",
"IntrospectionUtils",
".",
"findDefaultConstructor",
"(",
"clazz",
")",
... | Introspects the class and builds the metadata. | [
"Introspects",
"the",
"class",
"and",
"builds",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java#L117-L149 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java | ConstructorIntrospector.findNewBuilderMethod | public static MethodHandle findNewBuilderMethod(Class<?> clazz) {
MethodHandle mh = null;
for (String methodName : NEW_BUILDER_METHOD_NAMES) {
mh = IntrospectionUtils.findStaticMethod(clazz, methodName, Object.class);
if (mh != null) {
break;
}
}
return mh;
} | java | public static MethodHandle findNewBuilderMethod(Class<?> clazz) {
MethodHandle mh = null;
for (String methodName : NEW_BUILDER_METHOD_NAMES) {
mh = IntrospectionUtils.findStaticMethod(clazz, methodName, Object.class);
if (mh != null) {
break;
}
}
return mh;
} | [
"public",
"static",
"MethodHandle",
"findNewBuilderMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"MethodHandle",
"mh",
"=",
"null",
";",
"for",
"(",
"String",
"methodName",
":",
"NEW_BUILDER_METHOD_NAMES",
")",
"{",
"mh",
"=",
"IntrospectionUtils",
... | Finds and returns a method handle for new instance of a Builder class.
@param clazz
the persistence class
@return the method handle for the newBuilder/builder method | [
"Finds",
"and",
"returns",
"a",
"method",
"handle",
"for",
"new",
"instance",
"of",
"a",
"Builder",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ConstructorIntrospector.java#L158-L167 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshal | public static <T> T unmarshal(Entity nativeEntity, Class<T> entityClass) {
return unmarshalBaseEntity(nativeEntity, entityClass);
} | java | public static <T> T unmarshal(Entity nativeEntity, Class<T> entityClass) {
return unmarshalBaseEntity(nativeEntity, entityClass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Entity",
"nativeEntity",
",",
"Class",
"<",
"T",
">",
"entityClass",
")",
"{",
"return",
"unmarshalBaseEntity",
"(",
"nativeEntity",
",",
"entityClass",
")",
";",
"}"
] | Unmarshals the given native Entity into an object of given type, entityClass.
@param <T>
target object type
@param nativeEntity
the native Entity
@param entityClass
the target type
@return Object that is equivalent to the given native entity. If the given
<code>datastoreEntity</code> is <code>null</code>, returns <cod... | [
"Unmarshals",
"the",
"given",
"native",
"Entity",
"into",
"an",
"object",
"of",
"given",
"type",
"entityClass",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L81-L83 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshal | public static <T> T unmarshal(ProjectionEntity nativeEntity, Class<T> entityClass) {
return unmarshalBaseEntity(nativeEntity, entityClass);
} | java | public static <T> T unmarshal(ProjectionEntity nativeEntity, Class<T> entityClass) {
return unmarshalBaseEntity(nativeEntity, entityClass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"ProjectionEntity",
"nativeEntity",
",",
"Class",
"<",
"T",
">",
"entityClass",
")",
"{",
"return",
"unmarshalBaseEntity",
"(",
"nativeEntity",
",",
"entityClass",
")",
";",
"}"
] | Unmarshals the given native ProjectionEntity into an object of given type, entityClass.
@param <T>
target object type
@param nativeEntity
the native Entity
@param entityClass
the target type
@return Object that is equivalent to the given native entity. If the given
<code>datastoreEntity</code> is <code>null</code>, re... | [
"Unmarshals",
"the",
"given",
"native",
"ProjectionEntity",
"into",
"an",
"object",
"of",
"given",
"type",
"entityClass",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L97-L99 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshal | @SuppressWarnings("unchecked")
private <T> T unmarshal() {
try {
instantiateEntity();
unmarshalIdentifier();
unmarshalKeyAndParentKey();
unmarshalProperties();
unmarshalEmbeddedFields();
// If using Builder pattern, invoke build method on the Builder to
// get the final ... | java | @SuppressWarnings("unchecked")
private <T> T unmarshal() {
try {
instantiateEntity();
unmarshalIdentifier();
unmarshalKeyAndParentKey();
unmarshalProperties();
unmarshalEmbeddedFields();
// If using Builder pattern, invoke build method on the Builder to
// get the final ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"unmarshal",
"(",
")",
"{",
"try",
"{",
"instantiateEntity",
"(",
")",
";",
"unmarshalIdentifier",
"(",
")",
";",
"unmarshalKeyAndParentKey",
"(",
")",
";",
"unmarshalProperties... | Unmarshals the given Datastore Entity and returns the equivalent Entity POJO.
@param <T>
type
@return the entity POJO | [
"Unmarshals",
"the",
"given",
"Datastore",
"Entity",
"and",
"returns",
"the",
"equivalent",
"Entity",
"POJO",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L108-L129 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalBaseEntity | private static <T> T unmarshalBaseEntity(BaseEntity<?> nativeEntity, Class<T> entityClass) {
if (nativeEntity == null) {
return null;
}
Unmarshaller unmarshaller = new Unmarshaller(nativeEntity, entityClass);
return unmarshaller.unmarshal();
} | java | private static <T> T unmarshalBaseEntity(BaseEntity<?> nativeEntity, Class<T> entityClass) {
if (nativeEntity == null) {
return null;
}
Unmarshaller unmarshaller = new Unmarshaller(nativeEntity, entityClass);
return unmarshaller.unmarshal();
} | [
"private",
"static",
"<",
"T",
">",
"T",
"unmarshalBaseEntity",
"(",
"BaseEntity",
"<",
"?",
">",
"nativeEntity",
",",
"Class",
"<",
"T",
">",
"entityClass",
")",
"{",
"if",
"(",
"nativeEntity",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Unma... | Unmarshals the given BaseEntity and returns the equivalent model object.
@param nativeEntity
the native entity to unmarshal
@param entityClass
the target type of the model class
@return the model object | [
"Unmarshals",
"the",
"given",
"BaseEntity",
"and",
"returns",
"the",
"equivalent",
"model",
"object",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L140-L146 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalIdentifier | private void unmarshalIdentifier() throws Throwable {
IdentifierMetadata identifierMetadata = entityMetadata.getIdentifierMetadata();
Object id = ((Key) nativeEntity.getKey()).getNameOrId();
// If the ID is not a simple type...
IdClassMetadata idClassMetadata = identifierMetadata.getIdClassMetadata();
... | java | private void unmarshalIdentifier() throws Throwable {
IdentifierMetadata identifierMetadata = entityMetadata.getIdentifierMetadata();
Object id = ((Key) nativeEntity.getKey()).getNameOrId();
// If the ID is not a simple type...
IdClassMetadata idClassMetadata = identifierMetadata.getIdClassMetadata();
... | [
"private",
"void",
"unmarshalIdentifier",
"(",
")",
"throws",
"Throwable",
"{",
"IdentifierMetadata",
"identifierMetadata",
"=",
"entityMetadata",
".",
"getIdentifierMetadata",
"(",
")",
";",
"Object",
"id",
"=",
"(",
"(",
"Key",
")",
"nativeEntity",
".",
"getKey"... | Unamrshals the identifier.
@throws Throwable
propagated | [
"Unamrshals",
"the",
"identifier",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L161-L173 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalKeyAndParentKey | private void unmarshalKeyAndParentKey() throws Throwable {
KeyMetadata keyMetadata = entityMetadata.getKeyMetadata();
if (keyMetadata != null) {
MethodHandle writeMethod = keyMetadata.getWriteMethod();
Key entityKey = (Key) nativeEntity.getKey();
writeMethod.invoke(entity, new DefaultDatastore... | java | private void unmarshalKeyAndParentKey() throws Throwable {
KeyMetadata keyMetadata = entityMetadata.getKeyMetadata();
if (keyMetadata != null) {
MethodHandle writeMethod = keyMetadata.getWriteMethod();
Key entityKey = (Key) nativeEntity.getKey();
writeMethod.invoke(entity, new DefaultDatastore... | [
"private",
"void",
"unmarshalKeyAndParentKey",
"(",
")",
"throws",
"Throwable",
"{",
"KeyMetadata",
"keyMetadata",
"=",
"entityMetadata",
".",
"getKeyMetadata",
"(",
")",
";",
"if",
"(",
"keyMetadata",
"!=",
"null",
")",
"{",
"MethodHandle",
"writeMethod",
"=",
... | Unamrshals the entity's key and parent key.
@throws Throwable
propagated | [
"Unamrshals",
"the",
"entity",
"s",
"key",
"and",
"parent",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L182-L198 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalProperties | private void unmarshalProperties() throws Throwable {
Collection<PropertyMetadata> propertyMetadataCollection = entityMetadata
.getPropertyMetadataCollection();
for (PropertyMetadata propertyMetadata : propertyMetadataCollection) {
unmarshalProperty(propertyMetadata, entity);
}
} | java | private void unmarshalProperties() throws Throwable {
Collection<PropertyMetadata> propertyMetadataCollection = entityMetadata
.getPropertyMetadataCollection();
for (PropertyMetadata propertyMetadata : propertyMetadataCollection) {
unmarshalProperty(propertyMetadata, entity);
}
} | [
"private",
"void",
"unmarshalProperties",
"(",
")",
"throws",
"Throwable",
"{",
"Collection",
"<",
"PropertyMetadata",
">",
"propertyMetadataCollection",
"=",
"entityMetadata",
".",
"getPropertyMetadataCollection",
"(",
")",
";",
"for",
"(",
"PropertyMetadata",
"propert... | Unmarshal all the properties.
@throws Throwable
propagated | [
"Unmarshal",
"all",
"the",
"properties",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L206-L212 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalEmbeddedFields | private void unmarshalEmbeddedFields() throws Throwable {
for (EmbeddedMetadata embeddedMetadata : entityMetadata.getEmbeddedMetadataCollection()) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
unmarshalWithExplodedStrategy(embeddedMetadata, entity);
} else {
... | java | private void unmarshalEmbeddedFields() throws Throwable {
for (EmbeddedMetadata embeddedMetadata : entityMetadata.getEmbeddedMetadataCollection()) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
unmarshalWithExplodedStrategy(embeddedMetadata, entity);
} else {
... | [
"private",
"void",
"unmarshalEmbeddedFields",
"(",
")",
"throws",
"Throwable",
"{",
"for",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
":",
"entityMetadata",
".",
"getEmbeddedMetadataCollection",
"(",
")",
")",
"{",
"if",
"(",
"embeddedMetadata",
".",
"getStorageStra... | Unmarshals the embedded fields of this entity.
@throws Throwable
propagated | [
"Unmarshals",
"the",
"embedded",
"fields",
"of",
"this",
"entity",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L220-L228 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalWithExplodedStrategy | private void unmarshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target)
throws Throwable {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
unmarshalProperty(propert... | java | private void unmarshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target)
throws Throwable {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
unmarshalProperty(propert... | [
"private",
"void",
"unmarshalWithExplodedStrategy",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"throws",
"Throwable",
"{",
"Object",
"embeddedObject",
"=",
"initializeEmbedded",
"(",
"embeddedMetadata",
",",
"target",
")",
";",
"for",
"... | Unmarshals the embedded field represented by the given embedded metadata.
@param embeddedMetadata
the embedded metadata
@param target
the target object that needs to be updated
@throws Throwable
propagated | [
"Unmarshals",
"the",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"embedded",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L240-L254 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalWithImplodedStrategy | private static void unmarshalWithImplodedStrategy(EmbeddedMetadata embeddedMetadata,
Object target, BaseEntity<?> nativeEntity) throws Throwable {
Object embeddedObject = null;
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
FullEntity<?> nativeEmbeddedEntity = nul... | java | private static void unmarshalWithImplodedStrategy(EmbeddedMetadata embeddedMetadata,
Object target, BaseEntity<?> nativeEntity) throws Throwable {
Object embeddedObject = null;
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
FullEntity<?> nativeEmbeddedEntity = nul... | [
"private",
"static",
"void",
"unmarshalWithImplodedStrategy",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
",",
"BaseEntity",
"<",
"?",
">",
"nativeEntity",
")",
"throws",
"Throwable",
"{",
"Object",
"embeddedObject",
"=",
"null",
";",
"Cons... | Unmarshals the embedded field represented by the given metadata.
@param embeddedMetadata
the metadata of the field to unmarshal
@param target
the object in which the embedded field is declared/accessible from
@param nativeEntity
the native entity from which the embedded entity is to be extracted
@throws Throwable
prop... | [
"Unmarshals",
"the",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L268-L296 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.unmarshalProperty | private void unmarshalProperty(PropertyMetadata propertyMetadata, Object target)
throws Throwable {
unmarshalProperty(propertyMetadata, target, nativeEntity);
} | java | private void unmarshalProperty(PropertyMetadata propertyMetadata, Object target)
throws Throwable {
unmarshalProperty(propertyMetadata, target, nativeEntity);
} | [
"private",
"void",
"unmarshalProperty",
"(",
"PropertyMetadata",
"propertyMetadata",
",",
"Object",
"target",
")",
"throws",
"Throwable",
"{",
"unmarshalProperty",
"(",
"propertyMetadata",
",",
"target",
",",
"nativeEntity",
")",
";",
"}"
] | Unmarshals the property represented by the given property metadata and updates the target
object with the property value.
@param propertyMetadata
the property metadata
@param target
the target object to update
@throws Throwable
propagated | [
"Unmarshals",
"the",
"property",
"represented",
"by",
"the",
"given",
"property",
"metadata",
"and",
"updates",
"the",
"target",
"object",
"with",
"the",
"property",
"value",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L309-L312 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.setIdentifierMetadata | public void setIdentifierMetadata(IdentifierMetadata identifierMetadata) {
if (this.identifierMetadata != null) {
String format = "Class %s has at least two fields, %s and %s, marked with %s annotation. "
+ "Only one field can be marked as an identifier. ";
String message = String.format(forma... | java | public void setIdentifierMetadata(IdentifierMetadata identifierMetadata) {
if (this.identifierMetadata != null) {
String format = "Class %s has at least two fields, %s and %s, marked with %s annotation. "
+ "Only one field can be marked as an identifier. ";
String message = String.format(forma... | [
"public",
"void",
"setIdentifierMetadata",
"(",
"IdentifierMetadata",
"identifierMetadata",
")",
"{",
"if",
"(",
"this",
".",
"identifierMetadata",
"!=",
"null",
")",
"{",
"String",
"format",
"=",
"\"Class %s has at least two fields, %s and %s, marked with %s annotation. \"",... | Sets the metadata of the identifier. An exception will be thrown if there is an
IdentifierMetadata already set.
@param identifierMetadata
the metadata of the identifier. | [
"Sets",
"the",
"metadata",
"of",
"the",
"identifier",
".",
"An",
"exception",
"will",
"be",
"thrown",
"if",
"there",
"is",
"an",
"IdentifierMetadata",
"already",
"set",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L181-L191 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.setKeyMetadata | public void setKeyMetadata(KeyMetadata keyMetadata) {
if (this.keyMetadata != null) {
String format = "Class %s has two fields, %s and %s marked with %s annotation. Only one "
+ "field can be marked as Key. ";
String message = String.format(format, entityClass.getName(), this.keyMetadata.getNa... | java | public void setKeyMetadata(KeyMetadata keyMetadata) {
if (this.keyMetadata != null) {
String format = "Class %s has two fields, %s and %s marked with %s annotation. Only one "
+ "field can be marked as Key. ";
String message = String.format(format, entityClass.getName(), this.keyMetadata.getNa... | [
"public",
"void",
"setKeyMetadata",
"(",
"KeyMetadata",
"keyMetadata",
")",
"{",
"if",
"(",
"this",
".",
"keyMetadata",
"!=",
"null",
")",
"{",
"String",
"format",
"=",
"\"Class %s has two fields, %s and %s marked with %s annotation. Only one \"",
"+",
"\"field can be mar... | Sets the metadata of the Key field.
@param keyMetadata
the key metadata. | [
"Sets",
"the",
"metadata",
"of",
"the",
"Key",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L209-L219 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.setParentKetMetadata | public void setParentKetMetadata(ParentKeyMetadata parentKeyMetadata) {
if (this.parentKeyMetadata != null) {
String format = "Class %s has two fields, %s and %s marked with %s annotation. Only one "
+ "field can be marked as ParentKey. ";
String message = String.format(format, entityClass.get... | java | public void setParentKetMetadata(ParentKeyMetadata parentKeyMetadata) {
if (this.parentKeyMetadata != null) {
String format = "Class %s has two fields, %s and %s marked with %s annotation. Only one "
+ "field can be marked as ParentKey. ";
String message = String.format(format, entityClass.get... | [
"public",
"void",
"setParentKetMetadata",
"(",
"ParentKeyMetadata",
"parentKeyMetadata",
")",
"{",
"if",
"(",
"this",
".",
"parentKeyMetadata",
"!=",
"null",
")",
"{",
"String",
"format",
"=",
"\"Class %s has two fields, %s and %s marked with %s annotation. Only one \"",
"+... | Sets the metadata about the parent key.
@param parentKeyMetadata
the parent key metadata. | [
"Sets",
"the",
"metadata",
"about",
"the",
"parent",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L236-L246 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.setVersionMetadata | public void setVersionMetadata(PropertyMetadata versionMetadata) {
if (this.versionMetadata != null) {
throwDuplicateAnnotationException(entityClass, Version.class, this.versionMetadata,
versionMetadata);
}
this.versionMetadata = versionMetadata;
} | java | public void setVersionMetadata(PropertyMetadata versionMetadata) {
if (this.versionMetadata != null) {
throwDuplicateAnnotationException(entityClass, Version.class, this.versionMetadata,
versionMetadata);
}
this.versionMetadata = versionMetadata;
} | [
"public",
"void",
"setVersionMetadata",
"(",
"PropertyMetadata",
"versionMetadata",
")",
"{",
"if",
"(",
"this",
".",
"versionMetadata",
"!=",
"null",
")",
"{",
"throwDuplicateAnnotationException",
"(",
"entityClass",
",",
"Version",
".",
"class",
",",
"this",
"."... | Sets the metadata of the field that is used for optimistic locking.
@param versionMetadata
metadata of the field that is used for optimistic locking. | [
"Sets",
"the",
"metadata",
"of",
"the",
"field",
"that",
"is",
"used",
"for",
"optimistic",
"locking",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L263-L269 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.setCreatedTimestampMetadata | public void setCreatedTimestampMetadata(PropertyMetadata createdTimestampMetadata) {
if (this.createdTimestampMetadata != null) {
throwDuplicateAnnotationException(entityClass, CreatedTimestamp.class,
this.createdTimestampMetadata, createdTimestampMetadata);
}
this.createdTimestampMetadata =... | java | public void setCreatedTimestampMetadata(PropertyMetadata createdTimestampMetadata) {
if (this.createdTimestampMetadata != null) {
throwDuplicateAnnotationException(entityClass, CreatedTimestamp.class,
this.createdTimestampMetadata, createdTimestampMetadata);
}
this.createdTimestampMetadata =... | [
"public",
"void",
"setCreatedTimestampMetadata",
"(",
"PropertyMetadata",
"createdTimestampMetadata",
")",
"{",
"if",
"(",
"this",
".",
"createdTimestampMetadata",
"!=",
"null",
")",
"{",
"throwDuplicateAnnotationException",
"(",
"entityClass",
",",
"CreatedTimestamp",
".... | Sets the created timestamp metadata to the given value.
@param createdTimestampMetadata
the created timestamp metadata | [
"Sets",
"the",
"created",
"timestamp",
"metadata",
"to",
"the",
"given",
"value",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L288-L294 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.updateMasterPropertyMetadataMap | public void updateMasterPropertyMetadataMap(String mappedName, String qualifiedName) {
String old = masterPropertyMetadataMap.put(mappedName, qualifiedName);
if (old != null) {
String message = "Duplicate property %s in entity %s. Check fields %s and %s";
throw new EntityManagerException(
... | java | public void updateMasterPropertyMetadataMap(String mappedName, String qualifiedName) {
String old = masterPropertyMetadataMap.put(mappedName, qualifiedName);
if (old != null) {
String message = "Duplicate property %s in entity %s. Check fields %s and %s";
throw new EntityManagerException(
... | [
"public",
"void",
"updateMasterPropertyMetadataMap",
"(",
"String",
"mappedName",
",",
"String",
"qualifiedName",
")",
"{",
"String",
"old",
"=",
"masterPropertyMetadataMap",
".",
"put",
"(",
"mappedName",
",",
"qualifiedName",
")",
";",
"if",
"(",
"old",
"!=",
... | Updates the master property metadata map with the given property metadata.
@param mappedName
the mapped name (or property name in the datastore)
@param qualifiedName
the qualified name of the field
@throws EntityManagerException
if a property with the same mapped name already exists. | [
"Updates",
"the",
"master",
"property",
"metadata",
"map",
"with",
"the",
"given",
"property",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L352-L360 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.ensureUniqueProperties | private void ensureUniqueProperties(EmbeddedMetadata embeddedMetadata,
StorageStrategy storageStrategy) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
updateMasterPropertyMeta... | java | private void ensureUniqueProperties(EmbeddedMetadata embeddedMetadata,
StorageStrategy storageStrategy) {
if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
updateMasterPropertyMeta... | [
"private",
"void",
"ensureUniqueProperties",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"StorageStrategy",
"storageStrategy",
")",
"{",
"if",
"(",
"embeddedMetadata",
".",
"getStorageStrategy",
"(",
")",
"==",
"StorageStrategy",
".",
"EXPLODED",
")",
"{",
"for"... | Validates the embedded field represented by the given metadata to ensure there are no duplicate
property names defined across the entity.
@param embeddedMetadata
the metadata of the embedded field
@param storageStrategy
the storage strategy of the embedded field | [
"Validates",
"the",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"to",
"ensure",
"there",
"are",
"no",
"duplicate",
"property",
"names",
"defined",
"across",
"the",
"entity",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L413-L430 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.throwDuplicateAnnotationException | private static void throwDuplicateAnnotationException(Class<?> entityClass,
Class<? extends Annotation> annotationClass, PropertyMetadata metadata1,
PropertyMetadata metadata2) {
String format = "Class %s has at least two fields, %s and %s, with an annotation of %s. "
+ "A given entity can have ... | java | private static void throwDuplicateAnnotationException(Class<?> entityClass,
Class<? extends Annotation> annotationClass, PropertyMetadata metadata1,
PropertyMetadata metadata2) {
String format = "Class %s has at least two fields, %s and %s, with an annotation of %s. "
+ "A given entity can have ... | [
"private",
"static",
"void",
"throwDuplicateAnnotationException",
"(",
"Class",
"<",
"?",
">",
"entityClass",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
",",
"PropertyMetadata",
"metadata1",
",",
"PropertyMetadata",
"metadata2",
")",
"{... | Raises an exception with a detailed message reporting that the entity has more than one field
that has a specific annotation.
@param entityClass
the entity class
@param annotationClass
the annotation class
@param metadata1
the metadata of the first field
@param metadata2
the metadata of the second field that conflicts... | [
"Raises",
"an",
"exception",
"with",
"a",
"detailed",
"message",
"reporting",
"that",
"the",
"entity",
"has",
"more",
"than",
"one",
"field",
"that",
"has",
"a",
"specific",
"annotation",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L445-L453 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ExternalListenerIntrospector.java | ExternalListenerIntrospector.introspect | public static ExternalListenerMetadata introspect(Class<?> listenerClass) {
ExternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMet... | java | public static ExternalListenerMetadata introspect(Class<?> listenerClass) {
ExternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMet... | [
"public",
"static",
"ExternalListenerMetadata",
"introspect",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
")",
"{",
"ExternalListenerMetadata",
"cachedMetadata",
"=",
"cache",
".",
"get",
"(",
"listenerClass",
")",
";",
"if",
"(",
"cachedMetadata",
"!=",
"null",... | Introspects the given entity listener class and returns its metadata.
@param listenerClass
the entity listener class
@return the entity listener metadata | [
"Introspects",
"the",
"given",
"entity",
"listener",
"class",
"and",
"returns",
"its",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ExternalListenerIntrospector.java#L65-L80 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/ExternalListenerIntrospector.java | ExternalListenerIntrospector.introspect | private void introspect() {
if (!listenerClass.isAnnotationPresent(EntityListener.class)) {
String message = String.format(
"Class %s must have %s annotation to be used as an EntityListener",
listenerClass.getName(), EntityListener.class.getName());
throw new EntityManagerException(m... | java | private void introspect() {
if (!listenerClass.isAnnotationPresent(EntityListener.class)) {
String message = String.format(
"Class %s must have %s annotation to be used as an EntityListener",
listenerClass.getName(), EntityListener.class.getName());
throw new EntityManagerException(m... | [
"private",
"void",
"introspect",
"(",
")",
"{",
"if",
"(",
"!",
"listenerClass",
".",
"isAnnotationPresent",
"(",
"EntityListener",
".",
"class",
")",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Class %s must have %s annotation to be used ... | Introspects the listener class and creates the metadata. | [
"Introspects",
"the",
"listener",
"class",
"and",
"creates",
"the",
"metadata",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/ExternalListenerIntrospector.java#L85-L94 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.getMapper | public Mapper getMapper(Field field) {
PropertyMapper propertyMapperAnnotation = field.getAnnotation(PropertyMapper.class);
if (propertyMapperAnnotation != null) {
return createCustomMapper(field, propertyMapperAnnotation);
}
Class<?> fieldType = field.getType();
if (fieldType.equals(BigDecima... | java | public Mapper getMapper(Field field) {
PropertyMapper propertyMapperAnnotation = field.getAnnotation(PropertyMapper.class);
if (propertyMapperAnnotation != null) {
return createCustomMapper(field, propertyMapperAnnotation);
}
Class<?> fieldType = field.getType();
if (fieldType.equals(BigDecima... | [
"public",
"Mapper",
"getMapper",
"(",
"Field",
"field",
")",
"{",
"PropertyMapper",
"propertyMapperAnnotation",
"=",
"field",
".",
"getAnnotation",
"(",
"PropertyMapper",
".",
"class",
")",
";",
"if",
"(",
"propertyMapperAnnotation",
"!=",
"null",
")",
"{",
"ret... | Returns the mapper for the given field. If the field has a custom mapper, a new instance of the
specified mapper will be created and returned. Otherwise, one of the built-in mappers will be
returned based on the field type.
@param field
the field
@return the mapper for the given field. | [
"Returns",
"the",
"mapper",
"for",
"the",
"given",
"field",
".",
"If",
"the",
"field",
"has",
"a",
"custom",
"mapper",
"a",
"new",
"instance",
"of",
"the",
"specified",
"mapper",
"will",
"be",
"created",
"and",
"returned",
".",
"Otherwise",
"one",
"of",
... | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L116-L132 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.getMapper | public Mapper getMapper(Type type) {
Mapper mapper = cache.get(type);
if (mapper == null) {
mapper = createMapper(type);
}
return mapper;
} | java | public Mapper getMapper(Type type) {
Mapper mapper = cache.get(type);
if (mapper == null) {
mapper = createMapper(type);
}
return mapper;
} | [
"public",
"Mapper",
"getMapper",
"(",
"Type",
"type",
")",
"{",
"Mapper",
"mapper",
"=",
"cache",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"mapper",
"=",
"createMapper",
"(",
"type",
")",
";",
"}",
"return",
"... | Returns a mapper for the given type. If a mapper that can handle given type exists in the
cache, it will be returned. Otherwise, a new mapper will be created.
@param type
the type of field in the model class
@return a {@link Mapper} that is capable of mapping the given type. | [
"Returns",
"a",
"mapper",
"for",
"the",
"given",
"type",
".",
"If",
"a",
"mapper",
"that",
"can",
"handle",
"given",
"type",
"exists",
"in",
"the",
"cache",
"it",
"will",
"be",
"returned",
".",
"Otherwise",
"a",
"new",
"mapper",
"will",
"be",
"created",
... | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L142-L148 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.setDefaultMapper | public void setDefaultMapper(Type type, Mapper mapper) {
if (mapper == null) {
throw new IllegalArgumentException("mapper cannot be null");
}
lock.lock();
try {
cache.put(type, mapper);
} finally {
lock.unlock();
}
} | java | public void setDefaultMapper(Type type, Mapper mapper) {
if (mapper == null) {
throw new IllegalArgumentException("mapper cannot be null");
}
lock.lock();
try {
cache.put(type, mapper);
} finally {
lock.unlock();
}
} | [
"public",
"void",
"setDefaultMapper",
"(",
"Type",
"type",
",",
"Mapper",
"mapper",
")",
"{",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"mapper cannot be null\"",
")",
";",
"}",
"lock",
".",
"lock",
"(",
... | Sets or registers the given mapper for the given type. This method must be called before
performing any persistence operations, preferably, during application startup. Entities that
were introspected before calling this method will NOT use the new mapper.
@param type
the type
@param mapper
the mapper to use for the gi... | [
"Sets",
"or",
"registers",
"the",
"given",
"mapper",
"for",
"the",
"given",
"type",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"performing",
"any",
"persistence",
"operations",
"preferably",
"during",
"application",
"startup",
".",
"Entities",
"tha... | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L160-L170 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.createMapper | private Mapper createMapper(Type type) {
lock.lock();
try {
Mapper mapper = cache.get(type);
if (mapper != null) {
return mapper;
}
if (type instanceof Class) {
mapper = createMapper((Class<?>) type);
} else if (type instanceof ParameterizedType) {
mapper = ... | java | private Mapper createMapper(Type type) {
lock.lock();
try {
Mapper mapper = cache.get(type);
if (mapper != null) {
return mapper;
}
if (type instanceof Class) {
mapper = createMapper((Class<?>) type);
} else if (type instanceof ParameterizedType) {
mapper = ... | [
"private",
"Mapper",
"createMapper",
"(",
"Type",
"type",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Mapper",
"mapper",
"=",
"cache",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"return",
"mapper"... | Creates a new mapper for the given type.
@param type
the type for which a mapper is to be created
@return a mapper that can handle the mapping of given type to/from the Cloud Datastore. | [
"Creates",
"a",
"new",
"mapper",
"for",
"the",
"given",
"type",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L179-L199 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.createMapper | private Mapper createMapper(Class<?> clazz) {
Mapper mapper;
if (Enum.class.isAssignableFrom(clazz)) {
mapper = new EnumMapper(clazz);
} else if (Map.class.isAssignableFrom(clazz)) {
mapper = new MapMapper(clazz);
} else if (clazz.isAnnotationPresent(Embeddable.class)) {
mapper = new E... | java | private Mapper createMapper(Class<?> clazz) {
Mapper mapper;
if (Enum.class.isAssignableFrom(clazz)) {
mapper = new EnumMapper(clazz);
} else if (Map.class.isAssignableFrom(clazz)) {
mapper = new MapMapper(clazz);
} else if (clazz.isAnnotationPresent(Embeddable.class)) {
mapper = new E... | [
"private",
"Mapper",
"createMapper",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Mapper",
"mapper",
";",
"if",
"(",
"Enum",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"mapper",
"=",
"new",
"EnumMapper",
"(",
"clazz",
")",
... | Creates a mapper for the given class.
@param clazz
the class
@return the mapper for the given class. | [
"Creates",
"a",
"mapper",
"for",
"the",
"given",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L208-L221 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.createDefaultMappers | private void createDefaultMappers() {
BooleanMapper booleanMapper = new BooleanMapper();
CharMapper charMapper = new CharMapper();
ShortMapper shortMapper = new ShortMapper();
IntegerMapper integerMapper = new IntegerMapper();
LongMapper longMapper = new LongMapper();
FloatMapper floatMapper = n... | java | private void createDefaultMappers() {
BooleanMapper booleanMapper = new BooleanMapper();
CharMapper charMapper = new CharMapper();
ShortMapper shortMapper = new ShortMapper();
IntegerMapper integerMapper = new IntegerMapper();
LongMapper longMapper = new LongMapper();
FloatMapper floatMapper = n... | [
"private",
"void",
"createDefaultMappers",
"(",
")",
"{",
"BooleanMapper",
"booleanMapper",
"=",
"new",
"BooleanMapper",
"(",
")",
";",
"CharMapper",
"charMapper",
"=",
"new",
"CharMapper",
"(",
")",
";",
"ShortMapper",
"shortMapper",
"=",
"new",
"ShortMapper",
... | Creates and assigns default Mappers various common types. | [
"Creates",
"and",
"assigns",
"default",
"Mappers",
"various",
"common",
"types",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L250-L286 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.createCustomMapper | private Mapper createCustomMapper(Field field, PropertyMapper propertyMapperAnnotation) {
Class<? extends Mapper> mapperClass = propertyMapperAnnotation.value();
Constructor<? extends Mapper> constructor = IntrospectionUtils.getConstructor(mapperClass,
Field.class);
if (constructor != null) {
... | java | private Mapper createCustomMapper(Field field, PropertyMapper propertyMapperAnnotation) {
Class<? extends Mapper> mapperClass = propertyMapperAnnotation.value();
Constructor<? extends Mapper> constructor = IntrospectionUtils.getConstructor(mapperClass,
Field.class);
if (constructor != null) {
... | [
"private",
"Mapper",
"createCustomMapper",
"(",
"Field",
"field",
",",
"PropertyMapper",
"propertyMapperAnnotation",
")",
"{",
"Class",
"<",
"?",
"extends",
"Mapper",
">",
"mapperClass",
"=",
"propertyMapperAnnotation",
".",
"value",
"(",
")",
";",
"Constructor",
... | Creates and returns a custom mapper for the given field.
@param field
the field
@param propertyMapperAnnotation
property mapper annotation that specifies the mapper class
@return custom mapper for the given field | [
"Creates",
"and",
"returns",
"a",
"custom",
"mapper",
"for",
"the",
"given",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L297-L312 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/AbstractListenerMetadata.java | AbstractListenerMetadata.putListener | public void putListener(CallbackType callbackType, Method method) {
if (callbacks == null) {
callbacks = new EnumMap<>(CallbackType.class);
}
Method oldMethod = callbacks.put(callbackType, method);
if (oldMethod != null) {
String format = "Class %s has at least two methods, %s and %s, with a... | java | public void putListener(CallbackType callbackType, Method method) {
if (callbacks == null) {
callbacks = new EnumMap<>(CallbackType.class);
}
Method oldMethod = callbacks.put(callbackType, method);
if (oldMethod != null) {
String format = "Class %s has at least two methods, %s and %s, with a... | [
"public",
"void",
"putListener",
"(",
"CallbackType",
"callbackType",
",",
"Method",
"method",
")",
"{",
"if",
"(",
"callbacks",
"==",
"null",
")",
"{",
"callbacks",
"=",
"new",
"EnumMap",
"<>",
"(",
"CallbackType",
".",
"class",
")",
";",
"}",
"Method",
... | Registers the given method as the callback method for the given event type.
@param callbackType
the callback type
@param method
the callback method
@throws EntityManagerException
if there was already a callback method for the given event type. | [
"Registers",
"the",
"given",
"method",
"as",
"the",
"callback",
"method",
"for",
"the",
"given",
"event",
"type",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/AbstractListenerMetadata.java#L67-L79 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.