All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ibatis.cglib.NamingPolicy Maven / Gradle / Ivy

Go to download

The jBATIS persistence framework will help you to significantly reduce the amount of Java code that you normally need to access a relational database. iBATIS simply maps JavaBeans to SQL statements using a very simple XML descriptor.

The newest version!
/*
 * Copyright 2003 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 */
package org.ibatis.cglib;

/**
 * NamingPolicy
 * 

* Date: 2015-06-17,15:50:48 +0800 * * @author Song Sun * @version 1.0 */ public interface NamingPolicy { String getClassName(String prefix, String source, Object key, Predicate names); NamingPolicy INSTANCE = new NamingPolicy() { @Override public String getClassName(String prefix, String source, Object key, Predicate names) { if (prefix == null) { prefix = "org.ibatis.cglib.Null"; } else if (prefix.startsWith("java.")) { prefix = "_" + prefix; } String base = prefix + "_" + source.substring(source.lastIndexOf('.') + 1) + "ByJBati_" + Integer.toHexString(key.hashCode()); String attempt = base; int index = 2; while (names.evaluate(attempt)) attempt = base + index++; return attempt; } }; NamingPolicy SIMPLE = new NamingPolicy() { @Override public String getClassName(String prefix, String member, Object key, Predicate names) { String base = prefix + "_" + member + "_" + key; String attempt = base; int index = 2; while (names.evaluate(attempt)) attempt = base + index++; return attempt; } }; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy